[R] Multi-panel Pie Charts.
Jim Lemon
jim at bitwrit.com.au
Thu Mar 25 03:50:12 CET 2010
On 03/25/2010 06:00 AM, Gurmeet wrote:
> Hi All,
>
> I'm trying to find out a way to plot multi-panel pie charts. It may not be
> the best way to present data, but I would still need one.
>
Hi Gurmeet,
Your message prompted me to finish a little function that I had almost
forgotten.
panes<-function(nrow=2,ncol=2,mar=c(0,0,1.6,0),oma=c(2,1,1,1)) {
oldpar<-par("mar","mfrow","oma")
par(mfrow=c(nrow,ncol),mar=mar,oma=oma)
return(oldpar)
}
oldpar<-panes()
pie(foo$value[foo$month=="Jan"],labels=foo$variable[foo$month=="Jan"],
radius=0.7)
tab.title("January sales",tab.col="#cccc66")
box()
pie(foo$value[foo$month=="Feb"],labels=foo$variable[foo$month=="Feb"],
radius=0.7)
tab.title("February sales",tab.col="#cccc66")
box()
pie(foo$value[foo$month=="Mar"],labels=foo$variable[foo$month=="Mar"],
radius=0.7)
tab.title("March sales",tab.col="#cccc66")
box()
pie(foo$value[foo$month=="Apr"],labels=foo$variable[foo$month=="Apr"],
radius=0.7)
tab.title("April sales",tab.col="#cccc66")
box()
par(xpd=TRUE)
mtext("First quarter sales",at=-1.2,line=0.8,side=1,cex=1.5)
par(xpd=FALSE)
par(oldpar)
Is this what you wanted?
Jim
More information about the R-help
mailing list