MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Piechart labels Mathematica 7

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97368] Re: Piechart labels Mathematica 7
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 12 Mar 2009 02:16:07 -0500 (EST)
  • References: <gp7vvh$1fn$1@smc.vnet.net>

Hi Jackie,

I see various possibilities:

1. Change "RadialCenter" in "RadialOuter". Slightly more room there.
2. Change the font size from 12 to something smaller, 10 pts or so
3. Increase the ImageSize, makes the chart larger with respect to the
labels
4. Rotate the labels. Ideally, for a pie chart the rotation should be
dependend on the positions of the labels, but I don't see a simple
method to obtain them automatically. For now, I use a list that I
determine by eye:
LabelingFunction -> (Placed[
     Style[NumberForm[#, DigitBlock -> 3], Italic, 10], "RadialOuter",
      Function[{x},
      Rotate[x, {0, -65, -80}[[Position[varAFreq[[All, 2]], #][[1,
            1]] ]] Degree]
]] &)]

This uses the possibility of Placed to have a function as 3rd argument
to be applied on each label element (could have done that directly of
course). I find the position of that label in the list and use that as
an index in a rotations list. It's an ugly kludge, but it works.

Cheers -- Sjoerd

On Mar 11, 11:24 am, "jackie.lu" <jacki... at gmail.com> wrote:
> Hello all,
>
> I'm creating pie charts with sector labels but unfortunately the labels a=
re
> partially hidden by the next section of the pie chart because the slice
> itself is rather narrow.  Is there a way to place labels such that the =
label
> for a narrow slice isn't partially obscured by the next one?  I've sear=
ched
> the documentation and the forum but haven't been able to figure this out.
>
> This is the code I'm using.
>
> varAFreq={{"Alive", 41169}, {"Dead", 1916}, {"Missing", 2009}};
>
> PieChart[varAFreq[[All, 2]],
>  ImageSize -> Medium,
>  ChartStyle -> {LightGreen, Red, LightRed},
>  PlotLabel ->
>   Column[{Style["Phase I Trees", Bold, 14],
>     Style[Row[{" (",
>        NumberForm[Total[varAFreq[[All, 2]]], DigitBlock -> 3],
>        " trees surveyed)"}], Italic, 14]}],
>  ChartLabels ->
>   Placed[N[varAFreq[[All, 2]]/Total[varAFreq[[All, 2]]]*100] "%",
>    "RadialCallout", Style[NumberForm[#, {3, 1}], 12] &],
>  SectorOrigin -> {.5 Pi, -1},
>  LabelingFunction -> (Placed[
>      Style[NumberForm[#, DigitBlock -> 3], Italic, 12],
>      "RadialCenter"] &)]
>
> Thank you in advance!
> -jackie



  • Prev by Date: Notebooks that auto-execute when opened? -- SOLVED (I think)
  • Next by Date: Re: StringCases and Shortest
  • Previous by thread: Re: Re: Piechart labels Mathematica 7
  • Next by thread: Palettes Remembering Their Positions