getPlotAspect: Get aspect ratio for coordinates, plot, or device

getPlotAspectR Documentation

Get aspect ratio for coordinates, plot, or device

Description

Get aspect ratio for coordinates, plot, or device

Usage

getPlotAspect(
  type = c("coords", "plot", "device"),
  parUsr = par("usr"),
  parPin = par("pin"),
  parDin = par("din"),
  ...
)

Arguments

type

character type of aspect ratio to calculate.

"coords"

calculates plot coordinate aspect ratio, which is helpful for creating proper circular shapes, for example, where the x-axis and y-axis ranges are very different. Note that this calculation does also correct for margin sizes.

"plot"

calculates plot aspect ratio, based upon the actual size of the plot, independent of the numeric coordinate range of the plot. This aspect ratio reflects the relative visual height and width of the plot area, ignoring margins.

"device"

calculates plot aspect ratio, based upon the complete graphical device, i.e. the full space including all panels, margins, and plot areas.

parUsr, parPin, parDin

numeric values equivalent to their respective par() output, from par("usr"), par("pin"), and par("din"). Values can be supplied directly, which among other things, prevents opening a graphical device if one is not already opened. Any call to par() will otherwise cause a graphic device to be opened, which may not be desired on a headless R server.

...

additional parameters are ignored.

Value

numeric plot aspect ratio for a plot device, of the requested type, see the type argument.

See Also

Other jam plot functions: adjustAxisLabelMargins(), coordPresets(), decideMfrow(), drawLabels(), groupedAxis(), imageByColors(), imageDefault(), minorLogTicksAxis(), nullPlot(), plotPolygonDensity(), plotRidges(), plotSmoothScatter(), shadowText_options(), shadowText(), showColors(), smoothScatterJam(), sqrtAxis(), usrBox()

Examples

par("mfrow"=c(2,4));
for (i in 1:8) {
   nullPlot(plotAreaTitle=paste("Plot", i), xlim=c(1,100), ylim=c(1,10),
      doMargins=FALSE);
   axis(1, las=2);
   axis(2, las=2);
}
getPlotAspect("coords");
getPlotAspect("plot");
getPlotAspect("device");


jmw86069/jamba documentation built on March 26, 2024, 5:26 a.m.