pbdomains = <|
"Overall " -> Around[2.6, 0.04],
"PB" -> Around[4.25, 0.06]
|>;
BarChart[pbdomains, ChartStyle -> "BrightBands",
LabelStyle -> {FontFamily -> "Times New Roman", 28, Bold,
GrayLevel[0]}, Frame -> True, FrameLabel -> {"", " Count"},
BarSpacing -> Tiny,
ChartLabels -> Callout[Automatic, Above, Appearance -> "Balloon"]]
3 Answers
You can use PlotRangePadding
.
pbdomains = <|
"Overall " -> Around[2.6, 0.04],
"PB" -> Around[4.25, 0.06]
|>;
BarChart[pbdomains, ChartStyle -> "BrightBands",
LabelStyle -> {FontFamily -> "Times New Roman", 28, Bold,
GrayLevel[0]}, Frame -> True, FrameLabel -> {"", " Count"},
BarSpacing -> Tiny,
ChartLabels -> Callout[Automatic, Above, Appearance -> "Balloon"],
PlotRangePadding -> {{-1.4, -1.37}, {None, Scaled[0.2]}}]
Based on Rohit Namjoshi solution:
pbdomains = <|"Overall " -> Around[2.6, 0.04],
"PB" -> Around[4.25, 0.06]|>;
BarChart[pbdomains, ChartStyle -> "BrightBands",
LabelStyle -> {FontFamily -> "Times New Roman", 28, Bold,
GrayLevel[0]}, Frame -> True, FrameLabel -> {"", " Count"},
BarSpacing -> Tiny,
ChartLabels -> Callout[Automatic, Above, Appearance -> "Balloon"],
PlotRange -> {{0.5, 2.5}, All}]
1. Use the (undocumented) option "FixedBarSpacing"
as "FixedBarSpacing" -> True
or as Method -> {"FixedBarSpacing" -> True}
BarChart[pbdomains, ChartStyle -> "BrightBands",
LabelStyle -> {FontFamily -> "Times New Roman", 28, Bold,
GrayLevel[0]}, Frame -> True, FrameLabel -> {"", " Count"},
ChartLabels -> Callout[Automatic, Above, Appearance -> "Balloon"],
"FixedBarSpacing" -> True]
2. Use {pbdomains}
as the first argument and use the option BarSpacing -> {Tiny, 1}
:
BarChart[{pbdomains},
BarSpacing -> { Tiny, 1},
ChartStyle -> "BrightBands",
LabelStyle -> {FontFamily -> "Times New Roman", 28, Bold, GrayLevel[0]},
ImageSize -> Large, Frame -> True, FrameLabel -> {"", " Count"},
ChartLabels -> Callout[Automatic, Above, Appearance -> "Balloon"]]
PlotRange -> {{0.5, 2.5}, All}
. $\endgroup$