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 -------------- next part -------------- A non-text attachment was scrubbed... Name: qholt1prc_qholt0prc.png Type: image/png Size: 31304 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130924/d4d611ec/attachment.png>
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
On 09/25/2013 03:25 AM, Hermann Norpois wrote:> 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 >Hi Herman, My guess is that you want the x and y scales to have the same length in user units and perhaps even to have the same tick positions and values. For the 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,xlim=c(0,20),ylim=c(0,20)) Adding the solution that Bill provided: plot (a,b,xlim=c(0,20),ylim=c(0,20),asp=1) will ensure that the actual intervals on the x and y axes will be the same. Jim