[R] ggplot2: bug in geom_ribbon + log scale!?

Martin Rittner kmr at thegeologician.net
Sun Feb 17 23:02:50 CET 2008


'works nicely with loging the values. Thank you very much!

Keep on the great work, the more I use ggplot2, the more I love it!

Greetings, Martin


h.wickham at gmail.com wrote:
> Yes, that's a bug in the current version (fixed in the development
> version) - the problem is that the min and max aesthetics aren't being
> correctly scaled.  You can fix it by explicitly logging those values,
> or I can send you the development version off list if you remind me of
> your OS.
>
> Hadley
>
> On 2/17/08, Martin Rittner <kmr at thegeologician.net> wrote:
>   
>> Hi everyone, Hadley,
>>
>> it seems there's a bug in geom_ribbon() when using it in a log-scaled plot:
>>
>> d<-data.frame(x=c(1:20),y1=rnorm(20)+3,y2=rnorm(20)+5)
>> p<-ggplot()
>> p<-p+geom_ribbon(data=d,aes(x=d[["x"]],min=d[["y1"]],max=d[["y2"]]))
>> p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y1"]]),colour="blue")
>> p<-p+geom_line(data=d,aes(x=d[["x"]],y=d[["y2"]]),colour="red")
>> p2+scale_y_continuous()
>>
>> ...gives the plot I want, only with my actual data, I'd need it in
>> log-scale:
>>
>> p2+scale_y_log10()
>>
>> shifts the ribbon far above the actual data (factor 1000, if I see it
>> right, but I haven't tested it with different data to check on that...).
>>
>> I'm using the latest version of ggplot2 (0.5.7).
>>
>> Has anyone any suggestions for a workaround/patch?
>>
>> Many Thanks, Martin
>>
>> ______________________________________________
>> 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.
>>
>>     
>
>
>



More information about the R-help mailing list