Re: [R] Putting x-axis in opposite order

From: Breheny, Patrick <patrick.breheny_at_uky.edu>
Date: Thu, 28 Apr 2011 13:53:15 -0400

Try this:

plot(xx, yy, type="l", xlim=rev(range(xx)))



Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Bogaso Christofer Sent: Thursday, April 28, 2011 2:09 PM
To: r-help_at_r-project.org
Subject: [R] Putting x-axis in opposite order

Hi all, please consider this plot:  

xx <- seq(4, 0.01, by = -0.04)

yy <- rnorm(xx)

plot(xx, yy, type="l")  

Here you see my original 'xx' was in decreasing order, however R puts it in the increasing order. I understand that in any plot x and y axis grow is increasing order, however I am wondering whether I can manipulate this to suit my above particular problem, so that number displayed in x-axis would be in the given order.  

Thanks,

        [[alternative HTML version deleted]]



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.

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 28 Apr 2011 - 17:55:20 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 28 Apr 2011 - 18:10:35 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