Yes, the better way to achieve this is to not use pie charts.  Look at dotplots 
instead.

Single pie charts are hard enough to read, multiple ones in the same plot will 
invite comparisons that at best are hard and are often wrong and misleading.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Rajarshi Guha
> Sent: Monday, January 31, 2011 3:35 PM
> To: R
> Subject: [R] arranging pie charts in a matrix layout with row/col
> labels
> 
> Hi, I have a vector of data, that I group based on two factors via
> tapply. For each such grouping I would like to plot  a pie chart. I
> can layout these pie charts in a matrix layout, correpsonding to the
> levels of the two factors. But I am getting stuck on how to label the
> rows and colums. My current approach looks like this:
> 
> x <- data.frame(obs=sample(c('low', 'high'),100, replace=TRUE),
>                 grp1=sample(1:10, 100, replace=TRUE),
>                 grp2=runif(100))
> 
> cut.grp1 <- cut(x$grp1, 3)
> cut.grp2 <- cut(x$grp2, 3)
> 
> par(mfrow=c(3,3))
> tapply(x$obs, list(cut.grp1, cut.grp2), function(z) {
>   pie(table(z), col=c('red', 'green'))
> })
> 
> One possibility is to add an extra row and column to the layout and
> loop over the results of the tapply, adding a text label for the row
> and column labels.
> 
> Is there a better way to achieve this?
> 
> --
> Rajarshi Guha
> NIH Chemical Genomics Center
> 
> ______________________________________________
> 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.

______________________________________________
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.

Reply via email to