I wanna plot 2 gridlines in colors. One in red. Other in blue. How to do it?
Wrong code:
Plot[{x, x^2}, {x, 0, 1}, GridLines -> {{0.25, 0.5}, {}}, GridLinesStyle -> {{ {Red, Blue}}, {}}]
The previous solutions no longer seem to work (in v11.2.0).
However, you can style each gridline individually inside GridLines
like so:
Plot[
{x, x^2}, {x, 0, 1},
GridLines -> {
{{0.25, Red}, {0.5, Blue}},
{}
}
]
Any additional styling in GridLinesStyle
will also apply and override. Note this includes the default styling (seems to be lowered opacity) if you don't specify GridLinesStyle
!
GridLines -> {{{0.25, Red}, {0.5, Blue}}, {}}
$\endgroup$