Waichler, Scott R
2005-Oct-11 18:23 UTC
[R] How to get aspect ratio as output from from plot()
Is there a way to get the aspect ratio as output from a plot() call or something similar in the base graphics system? I would like to note vertical exaggeration on an elevation profile. Thanks, Scott Waichler Pacific Northwest National Laboratory scott.waichler at pnl.gov
Sundar Dorai-Raj
2005-Oct-11 18:44 UTC
[R] How to get aspect ratio as output from from plot()
Waichler, Scott R wrote:> Is there a way to get the aspect ratio as output from a plot() call or > something similar in the base graphics system? I would like to note > vertical exaggeration on an elevation profile. > > Thanks, > Scott Waichler > Pacific Northwest National Laboratory > scott.waichler at pnl.gov >Hi, Scott, Perhaps this will work for you? plot(1:10) w <- par("pin")[1]/diff(par("usr")[1:2]) h <- par("pin")[2]/diff(par("usr")[3:4]) asp <- w/h HTH, --sundar
Waichler, Scott R
2005-Oct-11 19:41 UTC
[R] How to get aspect ratio as output from from plot()
Sundar,> Perhaps this will work for you? > > plot(1:10) > w <- par("pin")[1]/diff(par("usr")[1:2]) > h <- par("pin")[2]/diff(par("usr")[3:4]) > asp <- w/hThank you for your help. For vertical exaggeration I will make a slight change to make it more intuitive (for me): w <- diff(par("usr")[1:2]) / par("pin")[1] # plot units per inch horizontal axis h <- diff(par("usr")[3:4]) / par("pin")[2] # plot units per inch vertical axis vertical.exaggeration <- w/h Scott Waichler