getSizePlot: Get dimensions for a clinical data plot

View source: R/plots-utility-dimensions.R

getSizePlotR Documentation

Get dimensions for a clinical data plot

Description

This function set sensitive defaults dimensions for a plot in the package. This includes:

  • setting a default width for a figure to fit in a standard clinical data review report

  • increasing the figure height:

    • for facetted plot, ensuring that each facet is relatively squared

    • if a caption, subtitle, title, title for the x-axis are specified

    • if a legend is set at the bottom or the top of the plot

    increasing the figure width if a legend is set at the left or the right of the plot

Usage

getSizePlot(
  width = NULL,
  height = NULL,
  gg = NULL,
  nrow = 1L,
  ncol = 1L,
  title = NULL,
  subtitle = NULL,
  caption = NULL,
  xLab = NULL,
  facet = FALSE,
  includeLegend = TRUE,
  legendPosition = "right",
  y = NULL
)

Arguments

width

Numeric, width of the plot in pixels, 700 by default.

height

Numeric, height of the plot in pixels, 700 by default.

gg

ggplot

nrow

single-length integer specifying the number of facet rows in the plot. (default = 1) Overwritten if gg is specified.

ncol

single-length integer specifying the number of facet columns in the plot. (default = 1) Overwritten if gg is specified.

title

String with title for the plot.

subtitle

String with subtitle.
The subtitle is included at the top left of the plot, below the title.

caption

String with caption.
The caption is included at the bottom right of the plot. Please note that this might overlap with vertical or rotated x-axis labels.

xLab

String with label for xVar.

facet

Logical, if TRUE the plot contains facets.

includeLegend

Logical, if TRUE (by default) a legend is available in the plot.

legendPosition

String with position of the legend, among: 'top'/'left'/'bottom'/'right', 'right' by default.

y

Character vector or factor with elements in the y-axis, or list of such vectors. If a list is provided, the maximum height obtained across the different list elements is used.

Value

Numeric vector with width ('width') and height ('height') of the plot in pixels.

Author(s)

Laure Cougnaud


clinDataReview documentation built on March 7, 2023, 5:13 p.m.