On Wed, 2006-10-11 at 02:27 -0700, Silvia Lipski wrote:
> Hi!
> 
> I'd like to plot things with axes going from the
> highest to the lowest value, so that e.g. high values
> on the xaxis are plotted to the left and low values to
> the right.
> Could anyone tell me how this is done? I couldn't find
> anything in the documentation.
> 
> Thanks a lot!
> Silli

Look at ?plot.default and in particular argument 'xlim', which take two
settings, effectively from and to, (e.g. xlim = c(100, 1) will give x
axis drawn from 100 on left to 1 on right)

plot(1:100, 1:100, xlim = c(175, 0))

Where we don't know the range of data explicitly, we can use for example
range() to get the min and max of the data and then rev() to reverse
these, as the example below shows:

xdat <- rnorm(100)
ydat <- runif(100)
plot(ydat ~ xdat, xlim = rev(range(xdat)))

The See Also section of ?plot would have pointed you to ?plot.default...

HTH

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson                 [t] +44 (0)20 7679 0522
 ECRC & ENSIS, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[email protected] 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.

Reply via email to