I'm quite new in Mathematica, and I would like to ask you to consider the next case:
I need to plot bar chart with error bars on logarithmic scale. From Wolfram site I took the function which allows to plot error bars on a bar chart with normal (non-log) scaling.
Thus, my ugly actual code looks like:
errorBar[type_: "Rectangle"][{{x0_, x1_}, {y0_, y1_}}, value_, meta_] :=
Block[{error},
error = Flatten[meta];
error = If[error === {}, 0, Last[error]];
{ ChartElementData[type][{{x0, x1}, {y0, y1}}, value, meta],
{Black, Line[{{{(x0 + x1)/2, y1 - error}, {(x0 + x1)/2, y1 + error}},
{{1/4 (3 x0 + x1), y1 + error}, {1/4 (x0 + 3 x1), y1 + error}},
{{1/4 (3 x0 + x1), y1 - error}, {1/4 (x0 + 3 x1), y1 - error}}}]}
}
]
figdata = {{4.01 -> 0.76, 1.73 -> 0.14, 3.95 -> 0.35},
{68.53 -> 16.32, 77.77 -> 11.13, 81.39 -> 27.32}};
xlables = {"r1", "r2"};
leftframename = "Frequency";
BarChart[ figdata, ChartElementFunction -> errorBar["Rectangle"],
ChartStyle -> {White, Gray, Black}, ChartLabels -> {xlables, None},
FrameLabel -> {None, Style[leftframename, 15, FontFamily -> "OpenSans"]},
FrameTicks -> {{{0, 10, 100, 1000}, None}, {None, None}},
Frame -> Left, BarSpacing -> {0, 0.5},
BaseStyle -> {FontWeight -> "Bold", FontSize -> 15},
ScalingFunctions -> "Log"]
And this produce the following graph:
which is not what I really would like to receive.
The problems, that I don't know how to solve:
- How to plot error bars in a proper way on log scale in
BarChart
? - How to make
FrameTicks
visible and on the same distance between each other?
Could anyone help me to put this together into working decision?