[R] plot - scaling axis

William Dunlap
Tue, 24 Sep 2013 20:46:57 -0000

Use asp=1 in the plot command.  E.g.,

par(mar=c(3,1,1,1), fig=c(0,1,.5,1)) ; plot(1:10, 1:10, asp=1)
par(new=TRUE, fig=c(0,.3,0,.5)) ; plot(1:10, 1:10, asp=1)
par(new=TRUE, fig=c(0.3,1,0,.5)) ; plot(1:10, 1:10, asp=1)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at
r-project.org] On Behalf
> Of Hermann Norpois
> Sent: Tuesday, September 24, 2013 10:26 AM
> To: r-help
> Subject: [R] plot - scaling axis
>
> Hello,
>
> i attached an example with two plotted vectors, respectively. And you might
> see that the y and x axis are not the same scale (e.g. the third and the
> last plot).
>
> I would prefer them to be the same scale.
>
> A toy example:
>
> a <- c (1,2,3,4,5,6,9,20)
> > b <- c (0.2,0.4,0.6,1,0.5,1,1,0.1)
> > plot (a,b)
>
> I would like to a have a plot with the same scales for the y and x axis.
>
> Could you please give me a hint how it works.
> thanks
> Hermann