[R] direction of axes of plot

Ross Ihaka ihaka at stat.auckland.ac.nz
Mon Jun 28 06:23:56 CEST 2004


XIAO LIU wrote:
> R users:
> 
> I want X-Y plotting with axes in reverse direction such as (0, -1, -2, -3, ....).  How can I do it?
> 
> Thanks in advance

Use the xlim and ylim arguments to plot.

	x = -(1:10)
	y = rnorm(10)

	# Standard plot
	plot(x, y)

	# Reversed x-axis
	plot(x, y, xlim=rev(range(x)))

-- 
Ross Ihaka                         Email:  ihaka at stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 85054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand




More information about the R-help mailing list