ggplot2 - Problem with grid plot
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.