On Fri, 17 Oct 2014 12:52:04 PM Gunnar Oehmichen wrote: > Hello, > > I would like to draw a circle on top of a pie chart (The plot does not > need to fullfill scientific standards). The circle represents the > relation of a reference-value in comparison to the summed values of the > pie-pieces. To be able to do this I partly followed: > http://rpubs.com/RobinLovelace/11641 . But i have the problem of some > bar/pie pieces being placed above the stacked bar/outside of the pie > chart, see graph PA / PA + coord_polar. > Hi Gunnar, I'm not certain that I have got the correct idea of what you want, but have a look at this:
library(plotrix) vals<-by(mdf$value,mdf$variable,sum) poss<-by(mdf$pos,mdf$variable,sum) radial.pie(poss,c(0,cumsum(6.28*vals/sum(vals))), labels=letters[1:5],show.grid.labels=3, radial.lim=c(0,max(poss))) legend(200000000,200000000,letters[1:5],fill=rainbow(5), bg="white") draw.circle(0,0,radius=poss[2],border="red") I didn't get exactly where you wanted the circle, so I guessed with the red circle. 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.