Re: [R] ggplot2 - Problem with grid plot

From: Chris Friedl <cfriedalek_at_gmail.com>
Date: Tue, 04 Mar 2008 16:24:01 -0800 (PST)

ONKELINX, Thierry wrote:
>
> Dear Chris,
>
> You'll need to add information on the facet factor (color) to the
> medians dataset.
>
> library(ggplot2)
> medians <- aggregate(diamonds$price, list(cut = diamonds$cut, color =
> diamonds$color), median)
> ggplot(data=diamonds, aes(x=price)) + geom_density(aes(color=cut)) +
> geom_vline(data=medians, aes(color=cut, intercept = x)) +
> facet_grid(color~.)
>
> HTH,
>
> Thierry
>
>

As they say downunder, YOU BLOODY BEAUTY!!!! (that's a good thing :) Not only can I now create the plot I want, but I also learned the aggregate function which is exactly what I was looking for as a way of trying to solve this problem. R has a steep learning curve but as you go up the view gets better and better. Thanks again for your help Thierry. And Hadley, thanks again for ggplot ... I'm appreciating its power with each day.

-- 
View this message in context: http://www.nabble.com/ggplot2---Problem-with-grid-plot-tp15825952p15840349.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Wed 05 Mar 2008 - 00:26:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 05 Mar 2008 - 00:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive