|
Hello,
does anybody know, how to reverse the elements of the x-axis. At now my x-axis for example goes from 0, 0.5, 1, 1.5, ... to 99.5, 100.0 Is there a way to change the x-axis, like this: 100.0, 99.5, 99.0, ..., 0.5, 0. The 100.0 should start at left x-axis and the 0 shold be on the right. Greeting |
|
This post has NOT been accepted by the mailing list yet.
Hello,
Try this: x<-c(1,4,7,9,10,15) y<-c(3,5,8,6,5,14) x1<-x[rev(order(x))] plot(x1,y,xlim=rev(range(x))) A.K. |
|
Thanks,
for the moment it works. But is there a possibility for a logarithmic x-Axis? When i use log='x' i get only a vertical line. Greetings |
|
In reply to this post by sappy
Hello,
Just reverse the xlim values, it defaults to c(min, max), use c(max, min). x <- 1:10 plot(x) plot(x, xlim=c(10, 1)) Hope this helps, Rui Barradas Em 29-07-2012 18:23, sappy escreveu: > Hello, > > does anybody know, how to reverse the elements of the x-axis. At now my > x-axis for example goes from 0, 0.5, 1, 1.5, ... to 99.5, 100.0 > Is there a way to change the x-axis, like this: 100.0, 99.5, 99.0, ..., 0.5, > 0. The 100.0 should start at left x-axis and the 0 shold be on the right. > > Greeting > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Reverse-order-of-x-axis-tp4638275.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
|
In reply to this post by sappy
(1) Please show context; r-help is *not* nabble. (2) You might like to investigate the revaxis() function from the "plotrix" package. cheers, Rolf Turner On 30/07/12 07:41, sappy wrote: > Thanks, > > for the moment it works. But is there a possibility for a logarithmic > x-Axis? When i use log='x' i get only a vertical line. > ______________________________________________ [hidden email] 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. |
|
In reply to this post by sappy
Show us what you actually did. Rui's example does not generate a problem
with a log axis but it is an index plot. This also does not generate any problems: > set.seed(42) > x <- runif(10)*100 > y <- runif(10)*100 > plot(x, y, xlim=c(100, 1), log="x") You wouldn't have used xlim=c(100, 0) and then specified a log axis would you? Since log(0) is -Inf, that could create problems. ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -----Original Message----- > From: [hidden email] [mailto:r-help-bounces@r- > project.org] On Behalf Of sappy > Sent: Sunday, July 29, 2012 2:41 PM > To: [hidden email] > Subject: Re: [R] Reverse order of x-axis > > Thanks, > > for the moment it works. But is there a possibility for a logarithmic > x-Axis? When i use log='x' i get only a vertical line. > > Greetings > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Reverse- > order-of-x-axis-tp4638275p4638282.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > [hidden email] 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. ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
