Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The following code

BarChart3D[
 Map[Labeled[#, Text[Style[#, Black, Opacity[1.], Bold, 20]], 
    Above] &, {{1, 0, 2}, {0, 0, 2}, {2, 1, 0}, {0, 2, 1}}, {2}], 
 ChartLayout -> "Grid", BarSpacing -> Large,
 ChartElements -> Graphics3D[Cylinder[]],
 ChartStyle -> Directive[Opacity[0.3]], 
 AxesLabel -> {None, None, None},
 Ticks -> {None, None, {0, 1, 2}},
 ChartLabels -> {Placed[{"O", "E", "R", "N"}, Axis], {"D", "N", "A"}},
 ViewPoint -> {1.3`, -2.4`, 2.`}]

Works an place labels near axis. And what's interesting is that as you move the box, i.e. change the ViewPoint, with your mouse, the labels change accordingly.

Mathematica graphics

So, there is something happening at the UI level with that positioning; and I couldn't find an option to place labels that worked for longer text. I need this

Mathematica graphics

to have labels properly placed. The chart labels are:

....
ChartLabels -> {
   Placed[{"Osteo", "Ewing", "Rhabdo", "Neuro"},  Axis],
   {"Dele", "Norm", "Ampl"}}
....

So, how to tell Mathematica to place labels on Axis but aligned properly?

Note: Placed[...,Axis] is the default; so I put it above just in case that rings a bell to someone.

share|improve this question
    
@Kuba, thanks for asking. BarChart3D rotate the labels as you change the point of view. The 3D position and overall size seem ok for very short labels as shown in first picture, but for longer labels it seems there is not enough room to display and they overflow the bottom plane. It is a little bit pedantic on my side, I am afraid, but if there is an option to change some position or size I am willing to spend some time perfecting the drawing ;-) –  caya Mar 20 at 0:50
1  
Does PlotRangePadding -> .5 fix your problem? –  Kuba Mar 20 at 9:40
    
It does! @Kuba, you should post it as answer; happy to accept it. PlotRangePadding -> .35 is just perfect :) –  caya Mar 20 at 10:50
    
Keep in mind that you can upvote answers you accepted too. Not that I need it very much :p but I've seen I'm not the only one that was accepted by you with score 0. –  Kuba Mar 21 at 10:25

1 Answer 1

up vote 0 down vote accepted

You can adjust PlotRangePadding:

Without:

enter image description here

And with PlotRangePadding -> {{0, 1}, {1, 0}, 0} enter image description here

p.s. both with BaseStyle -> {Bold, 18}

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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