Is it possible to get a GridLine over a BartChart ? Gridlines draw it under and Mesh does not seem to work with BarChart.
BarChart[{Range[10], Range[10]},
ChartLayout -> "Stacked",
GridLines -> {None, {4}},
GridLinesStyle -> Directive[Orange, Thick]]
This can be done via a method option:
BarChart[{Range[10], Range[10]}, ChartLayout -> "Stacked",
GridLines -> {None, {4}}, GridLinesStyle -> Directive[Orange, Thick],
Method -> {"GridLinesInFront" -> True}]
(this should work for any graphic.)
Your other option would be to draw the gridline explicitly with Epilog. This would be the solution if you wanted some gridlines (e.g. vertical ones) behind and some in front. I have added some other options in case you don't actually want the gridline to bleed over the axes.
BarChart[{Range[10], Range[10]}, ChartLayout -> "Stacked",
Epilog -> {Orange, Thick, Line[{{0, 4}, {3, 4}}]},
PlotRangeClipping -> True, PlotRangePadding -> 0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With