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

Paul Murrell p.murrell at auckland.ac.nz
Thu Nov 13 21:21:12 MET 2003


Hi


Duncan Murdoch wrote:
> 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))


That assumes that you know how the axis range is going to be calculated. 
  If a plotting function (barplot springs to mind) calculates the axis 
range internally then the user has a hard task to try and emulate that 
behaviour (in order to rev() it).  OTOH, the same point raises the 
potential problem that LOTS of plotting functions would possibly have to 
be updated because they assume that the x-scale goes left-to-right (here 
interaction.plot springs to mind because it allocates space within the 
plot for a legend).

Paul



> 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
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-devel mailing list