4
$\begingroup$

There are numerous options in Marthematica for pie chart labels positioning:

PieChart[Range[10], ChartLabels -> Placed[Range[10], "RadialCallout"], SectorOrigin -> {Automatic, 1}]

will display:

enter image description here

And this code:

Table[PieChart[{1, 2, 3}, ChartLabels -> Placed[{"a", "b", "c"}, p], 
  SectorOrigin -> {Automatic, 1}, 
  PlotLabel -> p], {p, {"RadialInner", "RadialCenter", 
   "RadialOuter"}}]

will display this:

enter image description here

How can one obtain labels so that only labels for several smallest sections are displayed outside the pie, using callouts, and all other labels are in the center or close to the center of correspondent sections? Like this:

enter image description here

Or:

enter image description here

$\endgroup$
8
$\begingroup$

Wrapping input data with Labeled:

PieChart[Labeled[#, #, If[# < 5, "RadialCallout", "RadialCenter"]] & /@ Range[10], 
         SectorOrigin -> {Automatic, 1}]

enter image description here

PieChart3D[Labeled[#, #, If[# < 5, "RadialCallout", "RadialCenter"]] & /@ Range[10], 
  SectorOrigin -> {Automatic, 1}, 
  ChartElementFunction -> ChartElementDataFunction["ProfileSector3D", "Profile" -> 3.1`]]

enter image description here

Using LabelingFunction:

PieChart[Range[10], SectorOrigin -> {Automatic, 1},
  LabelingFunction -> (Placed[#, If[# < 5, "RadialCallout", "RadialCenter"]] &)]

enter image description here

PieChart3D[Range[10],  SectorOrigin -> {Automatic, 1}, 
 LabelingFunction -> (Placed[#, If[# < 5, "RadialCallout", "RadialCenter"]] &), 
 ChartElementFunction -> ChartElementDataFunction["ProfileSector3D", "Profile" -> 3.1`]]

enter image description here

See also: Customizing individual labels in a PieChart

$\endgroup$
  • $\begingroup$ Great answer this adds a lot of flexibility! $\endgroup$ – Dragan Mrakovic Nov 11 '14 at 13:17
  • $\begingroup$ @Dragan, thank you for the accept; and welcome to mma.se. $\endgroup$ – kglr Nov 11 '14 at 13:22

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.