[R] Reversing axis label order

Steve Murray smurray444 at hotmail.com
Mon May 4 16:18:24 CEST 2009


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




More information about the R-help mailing list