Consider this example:

data = Table[{i, i + 20 Sin[RandomReal[-i, i]][[1]]}, {i, 1, 1000}];
Plot[x, {x, 0, 1000}, PlotStyle -> {Red, Thickness[0.01]}, 
  Epilog -> {PointSize[0.02], Point[data]}]

enter image description here

It can be seen that the points are rendered over the main plot and makes it invisible.

How to control the layers of plot so that to send a layer backward or to bring it forward.

  • 10
    $\begingroup$ Use Prolog, not Epilog. $\endgroup$ – m_goldberg Aug 26 '14 at 1:03
  • $\begingroup$ @m_goldberg Great, thanks. $\endgroup$ – Algohi Aug 26 '14 at 1:12
  • 2
    $\begingroup$ @m_goldberg This question may seem simple, but I'm not sure if it has been asked before. Why don't post that as an answer? $\endgroup$ – Dr. belisarius Aug 26 '14 at 1:16
  • 5
    $\begingroup$ Seems like we (as a site) have been on a question-closing rampage recently :/ I'd say keep it open and post the answer, too. $\endgroup$ – mfvonh Aug 26 '14 at 1:47
  • 1
    $\begingroup$ "Prolog is an option for graphics functions which gives a list of graphics primitives to be rendered before the main part of the graphics is rendered." That seems pretty clear to me. And Prolog is the first "See Also" link in the docs for Epilog. I agree with the close votes. Perhaps there are other questions unduly closed. $\endgroup$ – Michael E2 Aug 26 '14 at 3:03

As stated in the comments, a good solution is to use Prolog, rather than Epilog. The difference, of course, is that Graphics directives in Epilog are laid down on top of the plot, while Graphics directives in Prolog are laid down under the plot. Here's a simple example illustrating this difference.

Column[Framed[Plot[x^2, {x, -1.3, 1.3},
  # -> {Lighter[Gray], EdgeForm[Black],
   Polygon[{{-1, 0}, {1, 0}, {1, 1}, {-1, 1}}]},
 ImageSize -> 300, PlotLabel -> #]] & /@
{Epilog, Prolog}]

enter image description here


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