4
$\begingroup$

I am trying to change the ticks and range in a PairedBarChartbecause one of the ranges is much smaller than the other. How can I do this?

PairedBarChart[{{1, 2}, {3, 4}, {5, 6}}, {{0.2, 0.3}, {0.4, 
   0.1}, {0.1, 0.2}},
 PlotRange -> {{0, 6}, All},
 Ticks -> {{0, {3, "this"}, 6}, None}
 ]

enter image description here

Notice that the range doesnt permit seeing the values on the right correctly. Also, when you do Ticks->{{0,3,6},None} all is good, but when you want to rename one of them it goes nuts.

I don't mind rescaling the values in one of the lists, as long as I can change the ticks. Could you guys please help out?

Thanks

$\endgroup$
4
$\begingroup$
t = 10;
ticks = {0, 2, 4, 6, 8}; 
p = PairedBarChart[{{1, 2}, {3, 4}, {5, 6}}, 
                    t {{0.2, 0.3}, {0.4, 0.1}, {0.1, 0.2}}, 
                    Ticks -> {ticks, Automatic}, PerformanceGoal -> "Speed"]; 

p /. (Text[#, o : Offset[{_, _}, {_?(# > 0 &), _}], a___] :> Text[ #/t, o, a] & /@ ticks)

Mathematica graphics

$\endgroup$
3
$\begingroup$

Maybe you could do something like this

data = {{{1, 2}, {3, 4}, {5, 6}}, {{0.2, 0.3}, {0.4, 0.1}, {0.1, 0.2}}};

b1 = BarChart[First@data, AspectRatio -> 1, BarOrigin -> Right];
b2 = BarChart[Last@data,  AspectRatio -> 1, BarOrigin -> Left];

Grid[{{b1, b2}}]

enter image description here

$\endgroup$
  • $\begingroup$ To be honest, before knowing about PairedBarChart, that was indeed my approach. But I was expecting that something cleaner would exist, this because then aligning all labels (which I have not shown), among other things, would be more complicated. Still, this is a viable option if nothing else works $\endgroup$ – Sosi Jan 7 '16 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.