gg_ShowPlotDims: Determine and show dimensions of a ggplot2 object or derived...

View source: R/gg_ShowPlotDims.R

gg_ShowPlotDimsR Documentation

Determine and show dimensions of a ggplot2 object or derived gtable

Description

Function to determine and show dimensions of a ggplot2 object or derived gtable.

Usage

gg_ShowPlotDims(
  p,
  unit = "in",
  null = 3,
  null_x = NULL,
  null_y = NULL,
  xtick = 0.5,
  ytick = xtick,
  showPlot = TRUE,
  verbose = 0
)

Arguments

p
  • ggplot2 or derived gtable object

unit
  • plot units ("in", "cm", etc.)

null
  • size of (x and y) null (resizeable) units (in plot units; overridden if null_x and null_y are given)

null_x
  • size of horizontal null (resizeable) units (in plot units; must also specify null_y)

null_y
  • size of vertical (resizeable) units (in plot units; must also specify null_x)

xtick
  • x-axis tick separation

ytick
  • y-axis tick separation

showPlot
  • flag (T/F) to print plots

verbose
  • flag (0,1,2) to print intermediate information (0=off)

Details

This function converts "null" (relative) scales in a ggplot2 object (or derived gtable) to absolute scales and creates a rectangle plot of the resulting components with axes reflecting the absolute scales.

If either null_x or null_y is NULL, then the value of null is used for both. If both null_x and null_y are not NULL, these values are used for nulls along the correpsonding axes.

Value

invisibly returns a list with elements plot - plot of object components with axes reflecting inferred sizes dims - vector with plot width and height lyt - layout table (if verbose>1) tbl_rows - row dimensions (if verbose>1) tbl_cols - column dimensions (if verbose>1) tbl_matp -tibble with intermediate information (if verbose>1) tbl_matpp - tibble with intermediate information (if verbose>1)

Author(s)

William Stockhausen (william.stockhausen@noaa.gov)


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