graphsAdjust: Make adjustments to a graph eg zoom, titles etc etc

View source: R/graphicR.R

graphsAdjustR Documentation

Make adjustments to a graph eg zoom, titles etc etc

Description

Make adjustments to a graph eg zoom, titles etc etc

Usage

graphsAdjust(
  graphs,
  vertical = FALSE,
  xDiscrete = FALSE,
  yDiscrete = FALSE,
  xReverse = FALSE,
  yReverse = FALSE,
  xDefault = FALSE,
  yDefault = FALSE,
  xLimits = c(0, NA),
  yLimits = c(0, NA),
  xExpand = ggplot2::expansion(mult = 0, add = 0),
  yExpand = ggplot2::expansion(mult = 0, add = 0),
  xLabelFormat = ggplot2::waiver(),
  yLabelFormat = ggplot2::waiver(),
  xOob = scales::oob_squish_infinite,
  yOob = scales::oob_squish_infinite,
  xLog = FALSE,
  yLog = FALSE,
  xIsDate = FALSE,
  yIsDate = FALSE,
  titles = NA,
  xLabel = NA,
  yLabel = NA,
  setTheme = theme_minimal_adapted(),
  plot.margins.default = TRUE,
  plot.margins = c(5, 5, 5, 5),
  plot.margins.units = "points"
)

Arguments

graphs

list of ggplot-objects to which the adjustments have to be made Note: MUST be a list

vertical

if TRUE, flips x- and y-axis

xDiscrete

specifies whether the x-axis should be discrete

yDiscrete

specifies whether the y-axis should be discrete

xReverse

specifies whether to reverse the x-axis

yReverse

specifies whether to reverse the y-axis

xDefault

if TRUE, then xExpand, xLimits and xOob are ignored (essentially autoscaling the x-axis)

yDefault

same as xDefault, but for y-axis

xLimits

range of the x-axis, normally xLimits = c(minimum, maximum) if minimum and/or maximum is NA, then they are autoscaled, if xLimits = NA then the range is 0, putting all datapoints in one line (x-axis-wise)

yLimits

range of the y-axis (see xLimits)

xExpand

allows for padding around data (x-axis), see ?ggplot2::expansion for proper explanation

yExpand

allows for padding around data (y-axis), see ?ggplot2::expansion for proper explanation

xLabelFormat

defines the numeric format to be used for the x-axis labels (see fromatDigits() & formatScientificDigits() for examples)

yLabelFormat

defines the numeric format to be used for the y-axis labels (see fromatDigits() & formatScientificDigits() for examples)

xOob

defines what to do with data that's out of range of the data, see ?scales::oob for proper explanation. Note: only deals with x-axis

yOob

defines what to do with data that's out of range of the data, see ?scales::oob for proper explanation. Note: only deals with y-axis

xLog

if TRUE then automatic transformation of the x-axis to logarihmic scale

yLog

if TRUE then automatic transformation of the y-axis to logarihmic scale

xIsDate

if TRUE then all settings regarding the x-axis are ignored, except xLimits which should be dates (defaults are not dates). Alternatively xDefault can be set to TRUE for autoscaling

yIsDate

if TRUE then all settings regarding the y-axis are ignored except yLimits which should be dates (defaults are not dates). Alternatively xDefault can be set to TRUE for autoscaling

titles

sets title of graph

xLabel

sets x-axis title

yLabel

set y-axos title

setTheme

if NA, then no theme is applied, otherwise uses the defined theme (can also be ggplot2 included themes, such as theme_bw())

plot.margins.default

if TRUE, ignore plot.margins and other parameters

plot.margins

defines margins (from the border) of the plot c(top, right, bottom, left)

plot.margins.units

default = "points", other possibilities: ?grid::unit , examples "cm", "points", "inches", "npc" (viewport) etc etc

Value

a list of ggplot objects


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.