Looking at this question, I am reminded of a problem that I was never able to solve with obtaining a particular plot format.
The issue is that GridLines
sit behind anything in Prolog
. You can have gridlines with a colored background by giving the background a non-zero Opacity
.
Framed@Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True,
Prolog -> {LightGray, Opacity[0.5],
Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]},
GridLines -> {None, Automatic}]
But if the gridlines are to be white, this isn't feasible, it seems.
Framed@Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True,
Prolog -> {LightGray, Opacity[0.5],
Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]},
GridLines -> {None, Automatic},
GridLinesStyle -> Directive[AbsoluteThickness[2], White]]
Yes, you can use the undocumented option Method -> {"GridLinesInFront" -> True}
, as described in this answer, but then the gridlines go on top of the plot line as well as the background.
Framed@Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True,
Prolog -> {LightGray, Opacity[0.5],
Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]},
GridLines -> {None, Automatic},
GridLinesStyle -> Directive[AbsoluteThickness[2], White],
Method -> {"GridLinesInFront" -> True}]
Is there a way to reorder the Prolog
background or the gridlines somehow, so that white gridlines shock, but the gridlines don't go over the plotted function?
Try as I might I was never able to replicate this format (the axis numbers inside the frame are a whole other question).
GridLinesInFront
is documented in Graphics $\endgroup$ – Murta Jul 10 '14 at 16:54