[R] how to set the values of the axis in reverse order

Marc Schwartz MSchwartz at mn.rr.com
Fri Mar 17 02:10:06 CET 2006


On Fri, 2006-03-17 at 00:33 +0100, Jing Yang wrote:
> Dear R-users,
> 
> Does anybody know in plot() how to set the values of the axis in
> reverse order, like in excel there is an option to format the axis?
> 
> Best,Jing


Just reverse the range of the axis you want, using 'xlim' for x and/or
'ylim' for y:

  plot(1:10, xlim = c(10, 0))

See ?plot.default for more information.


Sometimes using a construct such as:

  ylim = rev(range(YourVector))

may be helpful as well.

See ?rev and ?range for more information.

HTH,

Marc Schwartz




More information about the R-help mailing list