What would be the easiest way to manipulate the position of the chart labels in "Grid" layout in a BarChart3D?

For example:

BarChart3D[{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}, ChartLayout -> "Grid", ChartLabels -> {Range[4], {a, b, c,}}, ViewPoint -> {3.33, -8.26, 5.36}, ColorFunction -> "TemperatureMap", BarSpacing -> {1, 1}, BaseStyle -> {FontSize -> 25}]

3D bar chart

I would like to move the "a", "b" and "c" labels to the other side of the axis, as it should be and is actually done automatically for the vertical one. I've tried using "Placed" with coordinates

ChartLabels -> Placed[{"a", "b", "c"}, {{1, 1, 1}, {0,0}}]

but this inserts a label onto EVERY SINGLE bar, not only near the axis.

A similar effect is obtained with "LabelingFunction":


Just for clarification of what I want to do, note that this results in three undesired features for me: * the labels are the values of the bars, * the bars are squeezed to the back instead of pushing the labels outside the plot area and * I can't use this to move the labels on both x and y axes, because ultimately I want to put the "1,2,3,4" also on the other side of the axis.

  • $\begingroup$ I think you should use LabelingFunction instead: look at the documentation in Options->LabelingFunction: reference.wolfram.com/language/ref/BarChart3D.html $\endgroup$ – mattiav27 May 6 '16 at 11:30
  • $\begingroup$ Add this option: AxesEdge -> {{1, 1}, {1, -1}, {1, 1}} $\endgroup$ – N.J.Evans May 6 '16 at 11:53
  • $\begingroup$ @mattiav27 Thanks for the idea. I played with that function a while and it also adds labels to all the bars. I could write a more complicated function, but I noticed that the labels keep being at the inner side of the plot by squeezing the bars towards the back, and after all I need to apply the same thing to the right axis (1,2,3,4), which means that I need something more than LabelingFunction, because it adds only one label per bar. $\endgroup$ – Rol May 9 '16 at 6:14
  • $\begingroup$ @N.J.Evans Thanks for the trick, it shifts the axis but keeps the labels in the inner part of the plot $\endgroup$ – Rol May 9 '16 at 6:15
  • 1
    $\begingroup$ Oh, I misunderstood, get rid of chart labels and add this option: Ticks -> {{{0.5, "a"}, { 2.5, "b"}, { 4.5, "c"}}, ({2*(# - 1.25) + 1, #} & /@ Range[4]), Automatic} You might have to play with positions to get everything right, but I think it's the only way with a BarChart $\endgroup$ – N.J.Evans May 9 '16 at 12:48

Your Answer

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

Browse other questions tagged or ask your own question.