procNiceOptions: Process plotting options

View source: R/np_options_processing.R

procNiceOptionsR Documentation

Process plotting options

Description

Integrates theme and user arguments to finalize all options prior to plotting

Usage

procNiceOptions(
  x,
  by,
  minorTick,
  pointShape,
  whiskerLineType,
  lWidth,
  capWidth,
  pointLaneWidth,
  width,
  guides,
  pointSize,
  subgroup = FALSE,
  stack = F,
  pointHighlights = F,
  type = c("BP", "VP", "DP", "Bar"),
  theme,
  plotColors,
  pointMethod,
  logScale,
  drawPoints,
  groupLabels,
  subgroupLabels = NULL,
  highlightLabels = NULL,
  swarmOverflow,
  errorCap = NULL,
  CLOptions = NULL
)

Arguments

x

Data to be plotted which has been pre-processed by dataFlightCheck

by

factor or data.frame of factors; One or more factors that control how the data is grouped. The first column is the primary grouping factor and the second and thrid columns are used for sub-grouping and highlighting as needed.

minorTick

numeric; Number of minor tick marks to be drawn between the major marks

pointShape

numeric; vector of numbers corresponding to pty options for ploting data overlays.

whiskerLineType

numeric; number corresponding to lty option for drawing the whiskers and error bars for box plots and bar plots, respectively.

lWidth

numeric; number corresponding to the lwd option for plotting lines on the graph

capWidth

numeric; Width of the cap relative to the bar/box width for box plots and bar plots.

pointLaneWidth

numeric; This controls how far data point dots can move along the categorical axis when plotting. Used for pointMethod options 'jitter', 'beeswarm', and 'distribution'.

width

numeric; A multiplier that controls how wide the plotting elements will be. Setting width=1.1 would result in plot elements being 10% wider.

guides

logical; Should guidelines be drawn at the major tick marks.

pointSize

numeric; A numeric vector controlling the size of points on the data overlay

subgroup

logical; Should the data be faceted into subgroups within the primary factor levels. Ignored if by is a factor.

stack

logical; Triggers stacked bar analysis for bar plots

pointHighlights

logical; will use additional factors in by to highlight points in the dot plot

type

character; What kind of plot is this for? Case sensitive options are "BP", "DP", "VP", and "Bar" corresponding to box plots, dot plots, violin plots, and bar plots, respectively.

theme

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

plotColors

list; a named list of vectors of colors that set the color options for all NicePlot functions. Names left unspecified will be added and set to default values automatically.

pointMethod

character; method to be used for ploting dots. Can be set to "jitter", "linear", "beeswarm" or "distribution".

logScale

numeric; Should a log scale use used (TRUE/FALSE)? Otherwise indicates the base for the log transformation.

drawPoints

logical; draws a dot plot overlay of the data.

groupLabels

character; A character vector to override factor labels for primary group names

subgroupLabels

character; A character vector to override factor labels for subgroup names

highlightLabels

character; A character vector to override factor labels for point highlights.

swarmOverflow

character; Valid options are: "none", "wrap", "gutter", "random", and "omit". Controls how to wantly point stacks that would overflow the pointLaneWidth option.

errorCap

character; Determines the style for the ends of the error bars. Valid options are ball, bar or none.

CLOptions

list; A list of command line options captured by ... being passed along to allow for theme values to be set directly from the function call even if it is not an explicit option.

Details

This is a private utility function used by NicePlots to integrate user options with theme defaults. Anything specified by the user is treated literally with no additional optimization. Colors, point shapes, fills, etc. are optimized to best enhance the relevant factor visualizations selected. The finalized parameters are returned as a named list.

Value

Named listed of graphical options

See Also

formatPlotColors, niceBox, niceDots, niceVio, niceBar


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