I am trying to control the overall width of a Labeled
bar chart. However, it seems whether I put ImageSize->225
as an option of BarChart
or as an option of Labeled
, the size 225
is actually the size of the graphics object produced by BarChart
and the labels will be outside this size (as shown in the figure below). When I Export
the figure pic
in pdf format, the width will exceed 225
due to the labels. How can I control the overall width of pic
to be exactly 225
? Besides, is there a way to shorten the "tick marks" of BarChart
below the horizontal axis?
Here is the code to produce the figure:
n = Range[10];
dat1 = 1/n^2;
dat2 = 0.9 dat1;
dat = {dat1, dat2};
sty = {Orange, Black};
SetOptions[BarChart,
BaseStyle -> {FontFamily -> "Times New Roman", FontSize -> 8},
AxesStyle -> AbsoluteThickness[0.5], LabelStyle -> Black];
SetOptions[Labeled,
LabelStyle -> {FontFamily -> "Times New Roman", FontSize -> 8}];
pic = Labeled[
BarChart[Transpose@dat, ChartStyle -> {Orange, Black},
BarSpacing -> {0, 1},
ChartLabels -> {Placed[n, Above, Style[#, FontSize -> 8] &], None},
AspectRatio -> 1/2, ImageSize -> 225], {"Horizontal Axis",
"Vertical Axis"}, {Bottom, Left}, RotateLabel -> True]