5
$\begingroup$

In real world usage you often want to use real world labels with long strings (say 15-20 characters) in 3D pie charts. Here is a toy example :

Clear[labeler];
labeler[datax_][v_, {1, c_}, ___] := 
  Placed[Column[{datax[[c]], v}, Alignment -> Center, 
    BaseStyle -> Directive[FontFamily -> "Arial", 11]], 
   "VerticalCallout"];
data = Transpose[{"This is label " <> ToString[#] & /@ Range[14], 
    Range[14]}];

PieChart3D[{data[[All, 2]]},
 ChartElementFunction -> 
  ChartElementDataFunction["ProfileSector3D", "Profile" -> 4],
 ChartStyle -> 54,
 ImageSize -> 400,
 LabelingFunction -> labeler[data[[All, 1]]],
 PerformanceGoal -> "Speed",
 PlotRange -> All,
 SectorOrigin -> {Pi, 0},
 SectorSpacing -> 0.2]

enter image description here

We see that the plot area seems to have been determined without reference to the labels that will be placed around the chart. Consequently the labels are cut off.

Q. Is this an Image Padding issue? A. no (note that All gives the same output as Full)

enter image description here

Q. So why not expand the margins around the image to give the labels enough space to be rendered?

enter image description here

So increasing the image margins merely creates another graphics area around the original image.

This looks like a bug or design flaw to me. Does anyone have any ideas about how to get VerticalCallout labels working in PieChart3D?

$\endgroup$
4
  • $\begingroup$ Setting ImagePadding to 100 works for me with your example. Also, possible duplicate ;-) $\endgroup$
    – ciao
    Commented Apr 22, 2014 at 2:05
  • $\begingroup$ Not really a duplicate @rasher :) The other post is dealing with vertical alignments. This one deals with visible range. Still looks like a bug or design flaw because ImagePadding->All should adjust to include the labels. i.e. you should not have to set a value for each specific chart. Having said that, the manual value for ImagePadding does provide a work around. $\endgroup$ Commented Apr 22, 2014 at 3:01
  • $\begingroup$ Ah - just saw titles, figured it was double-submit... sorry. Glad manual setting at least provides work-around. $\endgroup$
    – ciao
    Commented Apr 22, 2014 at 3:06
  • $\begingroup$ It seems like a ViewPoint issue. Try setting something like ViewPoint -> 1.4 {0, -2.4, 2}. (That vector is the default for PieChart3D.) Possible feature suggestion for WRI? "Make Graphic3D et al smart enough to scale ViewPoint to account for labels" or something to that effect? $\endgroup$
    – William
    Commented Apr 22, 2014 at 4:06

1 Answer 1

3
$\begingroup$

WRI Tech support confirm a bug. ImagePadding->All should work.

Edit

To address Bretts comment: In 2D ImagePadding->All works -- the ImageSize increases in the x direction by the amount of padding required. Nothing has to give. Why does something have to give in 3D?

enter image description here

$\endgroup$
5
  • $\begingroup$ What happens when you use the string form of this comment as the label for a chart? It won't line-wrap by default, and the graphic has a fixed size, so something has to give... $\endgroup$ Commented Apr 23, 2014 at 22:25
  • $\begingroup$ @BrettChampion If it is intended, as opposed to a genuine bug, that something has to "give" then it seems pointless offering "VerticalCallout" and RadialCallout" as labelling options in 3D for real world usage. In 2D of course nothing "gives" and ImagePadding->All works as expected. ...but then the vertical alignments of labels issues exists mathematica.stackexchange.com/questions/46549/… $\endgroup$ Commented Apr 23, 2014 at 22:31
  • $\begingroup$ @BrettChampion I could stick labels in a Pane with fixed size, and have them wrap, and then set a fixed ImagePadding based on the Pane width but still not seeing why ImagePadding->All does not work. $\endgroup$ Commented Apr 23, 2014 at 22:38
  • $\begingroup$ Can you post your code for that 2D chart? I'm not reproducing it. According to the docs for ImagePadding, "Padding specified by ImagePadding is left inside the region defined by ImageSize" (emphasis mine) so your picture in not what I expect to happen. $\endgroup$ Commented Apr 24, 2014 at 3:18
  • $\begingroup$ @BrettChampion the code is the same as the link in my first comment. Only change was to sub your first comment as one of the labels. I use ImageSize->{All,300} to ensure I get it all, otherwise what you state from the docs occurs. But this only works in 2D $\endgroup$ Commented Apr 24, 2014 at 3:52

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.