i've been doing a dynamic matrix plot using MousePosition but i need to rotate the plot 45°. but when i do that the MousePosition lose coordinates.
Any idea of how to do the rotation keeping MousePosition working?.
These is the code I´ve been using:
rowNumber[rowdim_] :=
If[# === None, #,
If[MatchQ[#, _?(1 <= # <= rowdim &)], #, None] &[
1 + rowdim - Last@Ceiling[#]]] &@MousePosition["Graphics"];
colNumber[coldim_] :=
If[# === None, #,
If[MatchQ[#, _?(1 <= # <= coldim &)], #, None] &[
First@Ceiling[#]]] &@MousePosition["Graphics"];
DynamicModule[{x = {}}, EventHandler[
Dynamic@MatrixPlot[
SparseArray[
Append[Map[# -> If[EvenQ@Count[x, #], 1, 0] &, x], {i_, j_} ->
1], {7, 7}],
Mesh -> All],
{"MouseClicked" :>
(x =
DeleteCases[
Append[x, {rowNumber[7],colNumber[7]}],
{a_, b_} /; a == None || b == None])}]]