[R] reversing the scale on ggplot

Pedro de Barros pbarros at ualg.pt
Wed Oct 31 11:56:56 CET 2007


Dear All,


I am trying to build a simple ggplot, but where the scale is 
reversed, i.e. the largest numbers are on the bottom.
An example of the code I am using is

 > plotdata<-data.frame(x=1:10, y=runif(10))
 > plot<-ggplot()
 > plot<-plot+layer(data=plotdata, mapping=aes_string(x='x',y='y'), 
geom='point', stat='identity', size=4)
 > plot<-plot+ scale_y_continuous(limits=c(1,0))
 > print(plot)
I was hoping that by reversing the limits argument I would obtain the 
result I wanted, but to no avail. I have searched the ggplot help and 
the archives, but cannot find the answer to this issue.
I would really appreciate if anyone could give me a pointer.

I am using R2.6.0 (patched) on Windows

Thanks,
Pedro



More information about the R-help mailing list