[R] Multi-panel Pie Charts.

Sharpie chuck at sharpsteen.net
Wed Mar 24 21:06:40 CET 2010



Gary Miller wrote:
> 
> Thanks for your reply Sharpie. I completely understand that it may not be
> the best to go with muti-panel pie charts, but my group would like to have
> this utility along with barplot/dotplot (may be, using it for proportions
> data). Thanks,
> 

Well, if the management trolls *DEMAND* pie, then these sites provide a good
start with ggplot2:

 
http://learnr.wordpress.com/2009/08/20/ggplot2-version-of-figures-in-lattice-multivariate-data-visualization-with-r-part-13-2/

  http://had.co.nz/ggplot2/coord_polar.html

Using the data I posted before, you could apply those approach with:

  productPie <- qplot( factor(1), value/100, data = productData,
    geom = 'bar', fill = variable,
    xlab = '',
    ylab = '' ) +
    facet_wrap( ~ month, scales = 'free_y' ) +
    coord_polar( theta = 'y' ) +
    scale_y_continuous( formatter = 'percent' ) +
    theme_bw()

  print( productPie )

The beauty of ggplot2 is that that is basically the same chart I posted last
time, the bars have just been "bent" into a pie through the use of
coord_polar().  It probably needs some fine-tuning, but I'll leave that up
to you.

Good luck!

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://n4.nabble.com/Multi-panel-Pie-Charts-tp1687026p1689591.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list