4
$\begingroup$

I can label groups in a bar chart but when trying to rotate the column labels I get unexpected results.

This works:

BarChart[{{1, 2, 3}, {4, 5, 6}}, 
 ChartLabels -> {{"c1", "c2"}, {"r1", "r2", "r3"}}]

this doesn't:

BarChart[{{1, 2, 3}, {4, 5, 6}}, 
 ChartLabels -> 
  Placed[{{"c1", "c2"}, {"r1", "r2", "r3"}}, Axis, Rotate[#, Pi/4] &]]

What am I doing wring?

$\endgroup$
2
  • 1
    $\begingroup$ BarChart[{{1, 2, 3}, {4, 5, 6}}, ChartLabels -> Map[Rotate[#, Pi/4] &, {{"c1", "c2"}, {"r1", "r2", "r3"}}, {2}]] $\endgroup$
    – Bob Hanlon
    Mar 2, 2017 at 14:15
  • $\begingroup$ ChartLabels -> (Placed[#, Axis, Rotate[#, Pi/4] &] & /@ {{"c1", "c2"}, {"r1", "r2", "r3"}}) $\endgroup$
    – kglr
    Mar 2, 2017 at 16:27

1 Answer 1

4
$\begingroup$

Placed should be inside the List:

BarChart[{{1, 2, 3}, {4, 5, 6}}, 
  ChartLabels -> {Placed[{"c1", "c2"}, Axis, Rotate[#, Pi/4] &], 
    Placed[{"r1", "r2", "r3"}, Axis, Rotate[#, Pi/4] &]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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