The following code works just fine with a few caveats.
a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
cl = {"Afghanistan", "Bangladesh", "Bhutan", "Cambodia", "Kiribati",
"Lao DPR", "Myanmar", "Nepal", "Samoa", "Solomon Islands",
"Timor-Leste", "Tuvalu", "Vanuatu"};
bchart1 = BarChart[
a,
ChartLabels -> cl,
ChartStyle -> LightBlue,
PlotTheme -> "Business",
BarOrigin -> Left,
PlotLabel -> Style["GDP per capita, 2011", Black, Bold, 12],
BarSpacing -> 0.3,
AxesLabel -> {"Millions US$"},
ImageSize -> 350,
Background -> LightGray
];
line1 = ParametricPlot[
{Mean[a], u}, {u, 0.3, Max[a]},
PlotRange -> {{0, Max[a]}, {0, Max[a]}},
PlotStyle -> {Directive[Black, Dashed]}
];
Show[bchart1, line1]
It produces:
There are three places that need to be corrected.
- Background color should be a little lighter than it is now;
- The vertical dashed line is the mean value of the chart values indicated. As one may see, the dashed line does not extend to the edge of the first bar from the top. The line should cover the entire range of the bars and also pass through the horizontal line just a bit and have a label "Average"; and
- Somehow
AxesLabel
does not place the x-axis label.
Thank you.