Is there some way to stop the y-axis plotting below the origin in the chart below. The PlotRangePadding
is required to make room for the labels, but it pulls the y-axis too low, (as indicated). The axis graphics don't seem to be editable.
data = {{3, 2}, {6, 3}, {8, 10}, {9, 9},
{3, 1}, {5, 2}, {6, 4}, {7, 8},
{4, 1}, {7, 2}, {9, 0}, {10, 12}};
bc = BarChart[data, BarSpacing -> {0, 1}, PerformanceGoal -> "Speed",
ChartStyle -> {LightOrange, LightGreen}, ImageSize -> 900, AspectRatio -> 0.4,
ChartLabels -> {Flatten@ConstantArray[{"Mar", "Jun", "Sep", "Dec"}, 3], None},
ImagePadding -> 8, PlotRangePadding -> {Automatic, {2, Automatic}}];
labels = MapThread[Inset[Style[#1, Bold, 16], {#2, -1.8}, {Center, Bottom}] &,
{{"2015", "2016", "2017"}, {6.5, 18.5, 30.5}}];
selopts = {AspectRatio, Axes, AxesOrigin, ImageSize, PlotRangePadding};
opts0 = selopts /. bc[[2]];
opts = Thread[selopts -> opts0];
Graphics[bc[[1]], opts, Epilog -> Append[labels,
Inset[SwatchLegend[{LightOrange, LightGreen}, Style[#, 12] & /@ {"Masha", "Bear"},
LegendMarkerSize -> 20, LegendFunction -> (Framed[#, RoundingRadius -> 4,
FrameStyle -> Gray] &)], {28, 10.5}]]]
PlotRangePadding
. $\endgroup$PlotRangePadding -> {Automatic, {0, Automatic}
is used it fixes the y-axis but chops off the year labels. I might have to useLabeled
for the year labels but then they are disconnected from the chart. Not too bad if the chart width is constant though. $\endgroup$