FormatPlot: Apply some standard formatting to a ggplot object.

View source: R/utils.R

FormatPlotR Documentation

Apply some standard formatting to a ggplot object.

Description

Apply some standard formatting to a ggplot object.

Usage

FormatPlot(
  data,
  x.col,
  y.col,
  facet.col,
  n.col.facet = 2,
  sample.size.col,
  sample.size.loc,
  plot.title = "",
  sub.title = "",
  facet.as.subtitle = TRUE,
  x.lab = "",
  y.lab = "",
  rotate.x.labs = FALSE,
  ymax,
  ymin,
  xmax,
  xmin,
  transform.x,
  transform.y
)

Arguments

data

Data frame containing the data to be plotted.

x.col

Column name of independent variable. If plot type only requires one variable (e.g. histogram), use only one of x.col or y.col.

y.col

Column name of dependent variable. If plot type only requires one variable (e.g. histogram), use only one of x.col or y.col.

facet.col

Column to facet on. If this results in only one facet, it will be used as a subtitle instead.

n.col.facet

Number of columns of facet grid.

sample.size.col

Column containing sample size labels.

sample.size.loc

Either 'xaxis' or 'plot'. 'xaxis' will add sample size to each x axis label. 'plot' will add sample size to the facet label (or subtitle, if only one facet).

plot.title

The title of the plot.

sub.title

Optional custom plot subtitle.

facet.as.subtitle

If only one facet, use facet name as subtitle? Defaults to TRUE.

x.lab

X axis label.

y.lab

Y axis label.

rotate.x.labs

Boolean indicating whether to rotate x axis labels 90 degrees.

ymax

Optional maximum y limit.

ymin

Optional minimum y limit.

xmax

Optional maximum x limit.

xmin

Optional minimum x limit.

transform.x

Optional x axis transformation. One of 'log10', 'sqrt', or 'reverse'.

transform.y

Optional y axis transformation. One of 'log10', 'sqrt', or 'reverse'.

Value

A ggplot object.


nationalparkservice/mojn-ds-rpackage documentation built on Oct. 5, 2023, 6:21 p.m.