update_aes: Override aes using the geom and class for user convenience

Description Usage Arguments Examples

View source: R/update-args.R

Description

Certain geoms don't play nice with certain aesthetics, so the aesthetics are modified to be more meaningful with that geom. See 'Examples'.

Usage

1
update_aes(class, aes, geom)

Arguments

class

The named vector with classes of the aesthetics.

aes

The currentaesthetics itself.

geom

The current geom.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library("ggplot2")
p <- ggplot(mtcars)
# nice
p + geom_violin(aes(factor(cyl), mpg))
# nonsense
p + geom_violin(aes(mpg, factor(cyl)))
mtcars %>%
  transform_cols("cyl", "as.factor") %>%
  vis_2d_distr(c("cyl", "mpg")) %>%
  pull_gg()
mtcars %>%
  transform_cols("cyl", "as.factor") %>%
  vis_2d_distr(c("mpg", "cyl")) %>%
  pull_gg()

lorenzwalthert/simplificar documentation built on May 7, 2019, 9:32 a.m.