[R] R-Graphics: Scaling axis

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 12 08:17:16 CET 2003


On Wed, 12 Mar 2003, Till Baumgaertel wrote:

> Hi,
> 
> how can I scale the x- and y-axis of a "plot" to the same scale?
> 
> My problem: The following command sequence produces the plot in a square.
> What I want is the x-axis to be 5 times as wide (measured e.g. in pixels)
> as the y-axis is long (because y ranges from -1 to 1 and x ranges from 0
> to 10).
> 
> x <- seq( from=0, to=10, by=.1)
> sinx <- sin(x)
> plot( x, sinx, type="l")
> 
> In noth help(plot) and help( par) I couldn't find a solution. What am I
> missing?

That's right - but the "see also" in ?plot gets you to ?plot.default,
which in turn gets you to ?plot.window:

     asp: numeric, giving the aspect ratio y/x.

where asp=1 will force plot to impose equal scales on the axes, and is 
passed through by plot().

Roger Bivand

> 
> Thanks for any hint,
> till
> 
> 
> 
> 
> ________________________________________
> Mehr Power für Ihre eMail - mit den neuen Leistungspaketen bei http://www.epost.de
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no



More information about the R-help mailing list