[R] Question about ggplot2 and stat_smooth
Thomas Adams
Thomas.Adams at noaa.gov
Tue Oct 4 23:38:14 CEST 2011
Hadley:
Below is an example of what I am trying to do, I just don't understand
how to supply the limits to the blue and pink shaded regions and the
values of the black line, which are meant to represent from bottom to
top, the 5%, 25%, 50%, 75%, 95% limits that I get from quantile():
h + geom_ribbon(aes(ymin=level-2, ymax=level+2),fill='pink')+
geom_ribbon(aes(ymin=level-1, ymax=level+1),fill='light blue')+
geom_line(aes(y=level))
My apologies for not explaining what I was after better previously.
Regards,
Tom
On 10/4/11 1:01 PM, Thomas.Adams at noaa.gov wrote:
> Hadley,
>
> Thanks for responding. No, not smoothed quantile regression. If you go here: http://www.erh.noaa.gov/mmefs/index.php and click on one of the colored squares, you can see we have 'boxplots'. What I want to express is the uncertainty as depicted in the example from 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<hadley at rice.edu>
> Date: Tuesday, October 4, 2011 10:23 am
> Subject: Re: [R] Question about ggplot2 and stat_smooth
> To: Thomas Adams<Thomas.Adams at noaa.gov>
> Cc: R-help forum<r-help at r-project.org>
>
>
>> On Mon, Oct 3, 2011 at 12:24 PM, Thomas Adams<Thomas.Adams at noaa.gov>
>> 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) using
>> 5%, 25%,
>>> 75%, 95% limits that I specify and where the heavy blue line is the
>> median.
>>> I don't understand how to do this with ggplot2.
>> Exactly what sort of limits do you want? It sounds like maybe you are
>> looking for smoothed quantile regression.
>>
>> Hadley
>>
>> --
>> Assistant Professor / Dobelman Family Junior Chair
>> Department of Statistics / Rice University
>>
> ______________________________________________
> 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.
--
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177
EMAIL: thomas.adams at noaa.gov
VOICE: 937-383-0528
FAX: 937-383-0033
More information about the R-help
mailing list