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.
Actually, it is plotting the points in the decreasing order. See: plot(xx) Are you looking to reverse the x axis? Perhaps you will find an answer in either ?par or ?axis. On Thu, Apr 28, 2011 at 2:09 PM, Bogaso Christofer <bogaso.christofer at gmail.com> wrote:> 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. >-- ==============================================Jon Daily Technician ==============================================#!/usr/bin/env outside # It's great, trust me.
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]]
On 04/29/2011 04:09 AM, Bogaso Christofer wrote:> 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. >Hi Bogaso, If all else fails, have a look at rev.axis in the plotrix package. Jim