Re: [R] reversing the scale on ggplot

From: hadley wickham <h.wickham_at_gmail.com>
Date: Wed, 2 Jan 2008 19:51:32 -0600

Hi Pedro,

Sorry for missing this email - the good news is that in the next version of ggplot (hopefully coming out in the next few days), you'll be able to do:

qplot(x, y, data=plotdata) + scale_x_reverse() qplot(x, y, data=plotdata) + scale_y_reverse()

to get reversed scales

Hadley

On Oct 31, 2007 4:56 AM, Pedro de Barros <pbarros_at_ualg.pt> wrote:
> 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
>
> ______________________________________________
> R-help@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.
>

-- 
http://had.co.nz/

______________________________________________
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.
Received on Thu 03 Jan 2008 - 01:55:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jan 2008 - 02:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive