I have a set of data with coordinate and a weight which I map with colours. I want a particular colour to appear on the top of others. For example
c[1] = Blue; c[2] = Red; c[3] = Green;
d1 = {RandomChoice[{1, 2, 3}], RandomReal[1, 2]} & /@ Range[20];
d2 = {RandomChoice[{1, 2, 3}], RandomReal[1, 2]} & /@ Range[20];
Graphics[{{c[#[[1]]], Disk[#[[2]], 0.1]} & /@ d1,
{c[#[[1]]], Disk[#[[2]], 0.1]} & /@ d2}]
Now I want all the red points to appear on the top layer. Manually I can double-click on each of them and use Move to Front
option.
Is it possible to do it with a command?
Graphics
. $\endgroup$FrontEndExecute[FrontEndToken["MoveToFront"]]
works. To test the code you can evaluateButton["x",FrontEndExecute[FrontEndToken["MoveToFront"]] ]
, select the disk, and click on the button. $\endgroup$