# ErrorBars/ other way of visualising deviation in Paired Bar Charts (PBC)

Data:

• three categories A,B,C
• values in each category: {median-semiIQR, sIQR (such that this value = median), sIQR (such that this value = median + sIQR)}

e.g. {{90, 21, 21}, {57, 14, 14}, {117, 69, 69}}

What I want:

Preferably, just bar indicating the median value, then an errorbar added, indicating the sIQR, but how is this done in a PBC?

Else: cat. A is Red, cat. B Blue and cat. C Green. The last two values of each category have to be Blended, so that they are Pinkish, Lightblueish and LightGreenish, to indicate that these are sIQRs.

In addition, I would like to display the median value for each category

• ErrorBar or ErrorListPlot? Needs["ErrorBarPlots"]. – Apple Sep 10 '14 at 9:47
• reference.wolfram.com/language/howto/Files/…. I'd like to have somthing like this, but the method mentioned there doesn't work with a PBC (that has its bars in the horizontal direction) – user18798 Sep 10 '14 at 9:49

Using a modification of the function errorBar in OP's other question (Spacing the elements in a bar chart with error bars) to make it work with PairedBarChart:

ClearAll[pbcErrorBar];
pbcErrorBar[type_: "GlassRectangle"][{{x0_, x1_}, {y0_, y1_}}, value_, meta_] :=
Block[{error, z}, error = Flatten[meta];
error = If[error === {}, 0, Last[error]]; z = If[x0 < 0, x0, x1];
{ChartElementData[type][{{x0, x1}, {y0, y1}}, value, meta],
{Black, Line[{{{z - error, (y0 + y1)/2}, {z + error, (y0 + y1)/2}},
{{z + error, 1/4 (3 y0 + y1)}, {z + error, 1/4 (y0 + 3 y1)}},
{{z - error, 1/4 (3 y0 + y1)}, {z - error, 1/4 (y0 + 3 y1)}}}]}}];


and data similar to the one in the same Q/A:

cd = {RandomReal[1, 10], RandomReal[0.1, 10]};
chartData = Flatten@MapThread[{#1 -> #2} &, cd];
chartData2 = MapAt[# + RandomReal[] &, chartData, {{;; , 1}}];


we get

PairedBarChart[{chartData}, {chartData2},
ChartElementFunction -> pbcErrorBar[],
ChartStyle -> Rest@ColorData[3, "ColorList"], ImageSize -> 500,
BaseStyle -> {FontFamily -> "Segoe UI", FontSize -> 16},
ChartLabels -> {Placed[Style[#, "Panel", 16] & /@ {"A", "B"}, Above],
None, Style[#, "Panel", 14] & /@ CharacterRange["a", "j"]}]
`