Re: [R] Pie chart

From: Jim Lemon <>
Date: Fri, 20 May 2011 19:17:46 +1000

On 05/19/2011 10:07 PM, Silvano wrote:
> I made a pie chart and the names of the levels are outside the circle.
> How do I put the names of the levels within each sector?
> names(tab13) = paste(c('Regular', 'Bom', 'Excelente'),
> round(100*prop.table(tab13), dig=1), "%")
> pie(tab13, col=c("LightYellow", "lightgreen", 'lightblue', 'white'),
> clockwise=F, radius=.7)
Hi Silvano,
I couldn't do it with "pie" from the graphics package as it doesn't return the positions for the labels, but...

plot(c(-1,1),c(-1,1),type="n",axes=FALSE,xlab="",ylab="") sector_angles<-floating.pie(0,0,tab13,
  col=c("LightYellow", "lightgreen", 'lightblue', 'white'),   radius=.7)
boxed.labels(cos(sector_angles)*0.5,sin(sector_angles)*0.5,   names(tab13))

I had to make up the data, so it may not look like yours.

Jim mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 20 May 2011 - 09:22:07 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 May 2011 - 10:00:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive