[R] Reversing axis label order
Patrizio Frederic
frederic.patrizio at gmail.com
Mon May 4 18:35:02 CEST 2009
Dear Steve,
I'm not sure I properly understood the question. Try
x<- aggregate_1986 # just a shortcut
n<- dim(x)[[1]]
matplot(x[n:1,1], x[n:1,2:3], type="l", col=2:3)
is that what you needed?
Patrizio
2009/5/4 Steve Murray <smurray444 at hotmail.com>:
>
> Dear R Users,
>
> I am executing the following command to produce a line graph:
>
> matplot(aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)
>
> On the x-axis I have values of Latitude (in column 1) ranging from -60 to +80 (left to right on the x-axis). However, I wish to have these values shown in reverse on the x-axis, going from +80 to -60 (ie. North to South in terms of Latitude). I have tried doing this by altering the command as follows:
>
> matplot(-aggregate_1986[,1], aggregate_1986[,2:3], type="l", col=2:3)
>
> ...but this produces the inverse sign of the latitude values along the axis - ie. it goes from -80 to +60.
>
> How do I reverse the display of the axis labels correctly and of course, maintain the associated data values correctly?
>
> Many thanks,
>
> Steve
>
> ______________________________________________
> 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.
>
--
+-------------------------------------------------
| Patrizio Frederic, PhD
| Assistant Professor,
| Department of Economics,
| University of Modena and Reggio Emilia,
| Via Berengario 51,
| 41100 Modena, Italy
|
| tel: +39 059 205 6727
| fax: +39 059 205 6947
| mail: patrizio.frederic at unimore.it
+-------------------------------------------------
More information about the R-help
mailing list