gg_FixOnePlotDim: Calculate the missing dimension of a ggplot2 object given the...

View source: R/gg_FixOnePlotDim.R

gg_FixOnePlotDimR Documentation

Calculate the missing dimension of a ggplot2 object given the other

Description

Function to calculate the missing dimension of a ggplot2 object given the other dimension.

Usage

gg_FixOnePlotDim(
  ggobj,
  fxdDim,
  fitWidth = TRUE,
  units = "in",
  verbose = FALSE,
  ...
)

Arguments

ggobj
  • a ggplot2 object (or possibly a gtable)

fxdDim
  • value for the fixed dimension

fitWidth
  • flag indicating fixed dimension is width

units
  • character string with units for the fixed ddimension

verbose
  • flag to print intermediate information

...
  • not used

Details

Based on code from the DeLuciatoR::get_dims function.

This function calculates the total height/width based on setting the total width/height (the latter determines the size of a "null" unit for expandable grobs). Another approach is taken in gg_GetPlotDims, which fixes the size of null units, then calculates the resulting height and width.

Value

a 2-element list (height, width) with the plot dimensions


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.