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,

~Gurmeet

On Wed, Mar 24, 2010 at 3:38 PM, Sharpie <ch...@sharpsteen.net> wrote:

>
>
> 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.
> >
>
> Would paneled bar charts not suffice?
>
> I don't mean to be harsh, but the only situation I can think of where I
> would consider a pie chart would be if I wanted to take advantage of the
> fact that people are worse at judging differences in area than they are at
> judging differences in length in order to hide some trend in my data.
>
> Anyway, the following code uses ggplot2 to produce a paneled bar plot from
> your data:
>
>  require( ggplot2 )
>
>  productData <- structure(list(variable = structure(c(1L, 1L, 1L, 1L, 2L,
> 2L,
>    2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c("ProdA",
>    "ProdB", "ProdC", "ProdD"), class = "factor"), month = structure(c(3L,
>    2L, 4L, 1L, 3L, 2L, 4L, 1L, 3L, 2L, 4L, 1L, 3L, 2L, 4L, 1L), .Label =
> c("Apr",
>    "Feb", "Jan", "Mar"), class = "factor"), value = c(25, 30, 25,
>    10, 25, 30, 50, 40, 40, 30, 20, 40, 10, 10, 5, 10)), .Names =
> c("variable",
>    "month", "value"), class = "data.frame", row.names = c(NA, -16L))
>
>  productPlot <- qplot( variable, value, data = productData, geom = 'bar',
>    xlab = 'Product', ylab = 'Percentage' ) +
>    facet_wrap( ~ month ) +
>    theme_bw()
>
>  print( productPlot )
>
>
> I know it's not what you want, but I personally need a strong argument for
> generating pie charts before I would perpetuate their use.
>
>
>
> Gurmeet wrote:
> >
> >
> > 1. Is anyone aware of some in-built script/function which can do this for
> > me. I'm aware of one given in Deepayan's book, but anything apart from
> > this?
> >
> >
> > 2. I tried using Deepayan's script on following data set but it doesn't
> > seem
> > to work as expected - labels are getting repeated/overlapping. I'm really
> > not sure what could be the problem, can anyone help please. I hope data
> is
> > in the right format, as expected.
> >
> >  Data read into object "foo":
> >
> > variable month value
> > ProdA   Jan    25
> > ProdA   Feb    30
> > ProdA   Mar    25
> > ProdA   Apr    10
> > ProdB   Jan    25
> > ProdB   Feb    30
> > ProdB   Mar    50
> > ProdB   Apr    40
> > ProdC   Jan    40
> > ProdC   Feb    30
> > ProdC   Mar    20
> > ProdC   Apr    40
> > ProdD   Jan    10
> > ProdD   Feb    10
> > ProdD   Mar     5
> > ProdD   Apr    10
> >
> > {SNIP}
> >
> > Thanks in advance,
> > Gurmeet
> >
>
> Providing data as a printed table, like you did, is not the most effective
> way to transmit example data on this list.  There are two major
> disadvantages:
>
>  *  Tabulated data often gets mangled in email
>
>  *  Tabulated data can not be copied and pasted directly into R to
> regenerate the example data.frame- it takes me ~4 minutes of mucking around
> with Excel to regenerate a .csv file that R can ingest.  This added time
> will limit the number of people who will attempt to investigate your
> problem.
>
> The best way to transmit the contents of a data frame is to paste the
> output
> of the dput() function.  This function dumps the data frame to an R command
> that can be simply copied and pasted into a R session to regenerate the
> data.frame.  The results of dput is the structure() command I used in my
> example above.
>
>
> Hope this helps in some way!
>
> -Charlie
>
> -----
> Charlie Sharpsteen
> Undergraduate-- Environmental Resources Engineering
> Humboldt State University
> --
> View this message in context:
> http://n4.nabble.com/Multi-panel-Pie-Charts-tp1687026p1689524.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
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