Re: [R] Reversing axis label order

2009-05-05 Thread Jim Lemon

Steve Murray wrote:

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?

  

Hi Steve,
Have a look at rev.axis in the plotrix package.

Jim

__
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.


Re: [R] Reversing axis label order

2009-05-04 Thread Patrizio Frederic
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 :
>
> 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@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.frede...@unimore.it
+-

__
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.


[R] Reversing axis label order

2009-05-04 Thread Steve Murray

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@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.