[Rd] wishlist item: changing origin of plot (PR#5045)

Duncan Murdoch dmurdoch at pair.com
Wed Nov 12 14:02:11 MET 2003


On Wed, 12 Nov 2003 10:24:28 +0100 (CET), you wrote:

>Do you think it would be worth adding options to plot commands to
>reverse axes?
>
>Here is a simple example:
> 
>> x <- 1:12
>> plot(x)
>  
>Whereas if I want the x-axis reversed, I need to know the range of
>the x data points:
> 
>>  plot(x, xlim=c(12,1))

This seems like a fairly obscure need, and it can be done by
calculating the range of x at plot time, e.g.

 plot(x, y, xlim=rev(range(x)))

or

 plot(y, xlim=c(length(y),1))

I'd be happier with including one of those in the example code rather
than with adding another couple of parameters to par.

Duncan Murdoch



More information about the R-devel mailing list