prepLegendMarigins: Set Legend Margins

prepLegendMariginsR Documentation

Set Legend Margins

Description

Calculate margin needed to plot a NicePlots legend

Usage

prepLegendMarigins(
  x,
  by,
  theme,
  legend,
  pointHighlights = FALSE,
  subgroup = TRUE,
  stack = FALSE,
  is2D = FALSE,
  preferMulti = FALSE,
  maxSize = FALSE,
  sizeColumn = FALSE
)

Arguments

x

numeric vector or data frame; The input to prepCategoryWindow can be a numeric vector a data frame of numeric vectors.

by

factor or data frame of factors; used as the primary grouping factor and the factor levels will be used as group names if groupLabels is not specified. If by is a data frame and subgroup=TRUE, the second column is assumed to be a secondary grouping factor, breaking out the data into sub-categories within each major group determined by the levels of the first column.

theme

list object; Themes are are an optional way of storing graphical preset options that are compatible with all nicePlot graphing functions.

legend

character; Title for the legend column. Set to TRUE if no header is desired.

pointHighlights

logical; Is pointHightlights turned on? This is used to determine with column of by should be used for legend factor levels.

subgroup

subgroup logical; use additional column in by to group the data within each level of the major factor.

stack

logical; Used for stack stacked bar plots. Used exclusively by niceBar.

is2D

logical; Is this for a 2D scatterplot or density plot? The first column of by will be use if set to TRUE.

preferMulti

logical; Are multiple legends preferred

maxSize

numeric; This is largest size scaling value for size scale legends. Defaults to FALSE

sizeColumn

numeric; This indicates which column should be used for the size scaling.

Details

This is a utility function used by the window setup routines to calculate how much space the legend will take up in the margin and setting the par(mai) accordingly.

Value

Does not return a value but changes the global par(mai) settings.

Examples

TODO<-1

ZachHunter/NicePlots.R documentation built on Sept. 23, 2023, 4:04 a.m.