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...
library(plotrix)
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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.