Re: [R] Question about ggplot2 and stat_smooth

2011-10-10 Thread Dylan Beaudette
specify the limits calculated for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. > > Tom > > - Original Message - > From: Hadley Wickham > Date: Tuesday, October 4, 2011 10:23 am > Subject: Re: [R] Question about gg

Re: [R] Question about ggplot2 and stat_smooth

2011-10-06 Thread Thomas Adams
Dennis & Hadley, This does exactly what I need — thank you so much! Regards, Tom On 10/4/11 5:34 PM, Dennis Murphy wrote: Hi Hadley: When I tried your function on the example data, I got the following: dd<- data.frame(year = rep(2000:2008, each = 500), y = rnorm(4500)) g<- function(df, qs

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas Adams
previous email where I can specify the limits calculated for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. Tom - Original Message - From: Hadley Wickham Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
Hi Hadley: When I tried your function on the example data, I got the following: dd <- data.frame(year = rep(2000:2008, each = 500), y = rnorm(4500)) g <- function(df, qs = c(.05, .25, .50, .75, .95)) { data.frame(q = qs, quantile(d$y, qs)) } ddply(dd, .(year), g) > ddply(dd, .(year), g) year

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
> # Function to compute quantiles and return a data frame > g <- function(d) { >   qq <- as.data.frame(as.list(quantile(d$y, c(.05, .25, .50, .75, .95 >   names(qq) <- paste('Q', c(5, 25, 50, 75, 95), sep = '') >   qq   } You could cut out the melt step by making this return a data frame: g <

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
m my previous email where I can > specify the limits calculated for the 'boxplots' using  5%, 25%,75%, 95% > limits as we have with the 'boxplots'. > > Tom > > - Original Message - > From: Hadley Wickham > Date: Tuesday, October 4, 2011 10:2

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas . Adams
ious email where I can specify the limits calculated for the 'boxplots' using 5%, 25%,75%, 95% limits as we have with the 'boxplots'. Tom - Original Message - From: Hadley Wickham Date: Tuesday, October 4, 2011 10:23 am Subject: Re: [R] Question about ggplot2 and stat_

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
On Mon, Oct 3, 2011 at 12:24 PM, Thomas Adams wrote: >  I'm interested in creating a graphic -like- this: > > c <- ggplot(mtcars, aes(qsec, wt)) > c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, alpha > = 0.2) > > but I need to show 2 sets of bands (with different shading) u

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Andrés Aragón
Hi, Try some like this: c <- ggplot(mtcars, aes(qsec, mpg, colour=factor(cyl))) c + stat_smooth(aes(group=cyl))+stat_smooth(aes(fill=factor(cyl)))+geom_point() Andrés AM 2011/10/3, Thomas Adams : > I'm interested in creating a graphic -like- this: > > c <- ggplot(mtcars, aes(qsec, wt)) > c

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Thomas Adams
Andrés, Thank you for your help, but that does not capture what I'm looking for. I need to be able to control the shaded bound limits and they need to be coincident. Tom On 10/3/11 3:37 PM, Andrés Aragón wrote: Hi, Try some like this: c<- ggplot(mtcars, aes(qsec, mpg, colour=factor(cyl)))

Re: [R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Dennis Murphy
Hi: I would think that, at least in principle, this should work: a <- ggplot(mtcars, aes(qsec, wt)) a + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, level = 0.9, alpha = 0.2) + stat_smooth(fill = 'blue', colour = 'darkblue', size = 2,

[R] Question about ggplot2 and stat_smooth

2011-10-03 Thread Thomas Adams
I'm interested in creating a graphic -like- this: c <- ggplot(mtcars, aes(qsec, wt)) c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, alpha = 0.2) but I need to show 2 sets of bands (with different shading) using 5%, 25%, 75%, 95% limits that I specify and where the hea