1
$\begingroup$

Is it possible to make the points appear on the ArrayPlot? It doesn't have to be ListPlot to plot the points.

Following is the code:

getBaSin[x_, y_] := RandomInteger[{1, 3}]

plot1 = ArrayPlot[
  ParallelTable[
   getBaSin[x, y], {y, 0.3, -0.3, -0.1}, {x, -0.3, 0.3, 0.1}], 
  ColorRules -> {1 -> Red, 2 -> Green, 3 -> Blue}]
plot2 = ListPlot[{{-0.082788, 0}, {0.041394, 
    0.071696}, {0.041394, -0.071696}}]
Show[{plot1, plot2}]
$\endgroup$

closed as off-topic by Szabolcs, Carl Lange, MarcoB, bbgodfrey, garej May 27 at 13:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Szabolcs, Carl Lange, MarcoB, bbgodfrey, garej
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    $\begingroup$ Please create a minimal example that illustrates the issue. Can you replace this with only three lines of code? Most of the code here is completely irrelevant to the question. See here for guidance. mathematica.meta.stackexchange.com/questions/2126/… $\endgroup$ – Szabolcs May 22 at 7:53
  • 3
    $\begingroup$ Remove the AbsoluteTiming, then it works. You either need to rescale coordinates or use DataRange in ArrayPlot. $\endgroup$ – Szabolcs May 22 at 7:55
  • $\begingroup$ Is there alternative way of AbsoluteTiming in this case? $\endgroup$ – 최준호 May 22 at 10:39
  • 3
    $\begingroup$ Use a=b;//AsboluteTiming which is equivalent to AbsoluteTiming[a=b;]. Do not use a = b // AbsoluteTiming because it is equivalent to a = AbsoluteTiming[b]. $\endgroup$ – Szabolcs May 22 at 10:42
3
$\begingroup$
SeedRandom[1]
mat = Table[getBaSin[x, y], {y, 0.3, -0.3, -0.1}, {x, -0.3, 0.3, 0.1}];
points = {{-0.082788, 0}, {0.041394, 0.071696}, {0.041394, -0.071696}};
ArrayPlot[mat, 
    ColorRules -> {1 -> Red, 2 -> Green, 3 -> Blue}, 
    DataRange -> {{-.3, .3}, {-.3, .3}}, 
    Epilog -> {Black, PointSize[Large], Point @ points}, 
    FrameTicks -> All]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.