add_common_aes: Adds aesthetics to all plots to reduce code duplication

Description Usage Arguments Value

View source: R/add_common_aes.R

Description

Adds aesthetics to all plots to reduce code duplication

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
add_common_aes(
  gplot,
  txtsize,
  scale_name = waiver(),
  col = c("none", "full", "bw"),
  col_aes = c("fill", "color"),
  lval = 50,
  greystart = 0.2,
  greyend = 0.8,
  continuous = c("none", "x", "y"),
  n_x_ticks = 6,
  n_y_ticks = 6,
  xbreaks = NULL,
  ybreaks = NULL,
  xlim = NULL,
  ylim = NULL,
  xtrans = "identity",
  ytrans = "identity",
  xexpand = waiver(),
  yexpand = waiver(),
  facet_lab_txtsize = NULL,
  ...
)

Arguments

gplot

a ggplot object

txtsize

base text size

scale_name

how to name scale. Default inherits from variable name.

col

either none, full color, or black and white

col_aes

which aesthetics to modify with col

lval

color lightness - 0 to 100

greystart

between 0 and 1. used in greyscale only. smaller numbers are lighter

greyend

between 0 and 1, greater than greystart.

continuous

which axes are continuous and should be modified by this function

n_x_ticks, n_y_ticks

number of axis ticks

xbreaks, ybreaks

vector of axis breaks. will override n_x_ticks and/or n_y_ticks if provided.

xlim, ylim

vector of axis limits, or NULL, which sets limits automatically

xtrans, ytrans

transformations for the axes. See scale_continuous for details.

xexpand, yexpand

Padding around data. See scale_continuous for details. The default behavior in ggplot2 is expansion(0.05). See expansion for how to modify this.

facet_lab_txtsize

text size for plot facet labels

...

further arguments to plot. This is not used by dampack but required for generic consistency.

Value

a ggplot2 plot updated with a common aesthetic


dampack documentation built on May 31, 2021, 1:06 a.m.