Skip to content

Instantly share code, notes, and snippets.

@grantmcdermott
Forked from dpseidel/default_aes.md
Created August 20, 2019 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantmcdermott/97c4703a1c3e731844af9892c368a6fa to your computer and use it in GitHub Desktop.
Save grantmcdermott/97c4703a1c3e731844af9892c368a6fa to your computer and use it in GitHub Desktop.
Default ggplot2 aesthetics table

Default ggplot2 aesthetics by geom.

geom alpha angle colour family fill fontface height hjust lineheight linetype shape size stroke vjust weight width xmax xmin ymax ymin
GeomAbline NA black 1 0.5
GeomAnnotationMap NA NA grey20 1 0.5
GeomArea NA NA grey20 1 0.5
GeomBar NA NA grey35 1 0.5
GeomBoxplot NA grey20 white solid 19 0.5 1
GeomCol NA NA grey35 1 0.5
GeomContour NA #3366FF 1 0.5 1
GeomCrossbar NA black NA 1 0.5
GeomCurve NA black 1 0.5
GeomCustomAnn Inf -Inf Inf -Inf
GeomDensity NA black NA 1 0.5 1
GeomDensity2d NA #3366FF 1 0.5
GeomDotplot NA black black
GeomErrorbar NA black 1 0.5 0.5
GeomErrorbarh NA black 0.5 1 0.5
GeomHex NA NA grey50 0.5
GeomHline NA black 1 0.5
GeomLabel NA 0 black white 1 0.5 1.2 3.88 0.5
GeomLine NA black 1 0.5
GeomLinerange NA black 1 0.5
GeomLogticks 1 black 1 0.5
GeomMap NA NA grey20 1 0.5
GeomPath NA black 1 0.5
GeomPoint NA black NA 19 1.5 0.5
GeomPointrange NA black NA 1 19 0.5 1
GeomPolygon NA NA grey20 1 0.5
GeomQuantile NA #3366FF 1 0.5 1
GeomRaster NA grey20
GeomRect NA NA grey35 1 0.5
GeomRibbon NA NA grey20 1 0.5
GeomRug NA black 1 0.5
GeomSegment NA black 1 0.5
GeomSf NA NULL NULL 1 NULL NULL 0.5
GeomSmooth 0.4 #3366FF grey60 1 1 1
GeomSpoke NA black 1 0.5
GeomStep NA black 1 0.5
GeomText NA 0 black 1 0.5 1.2 3.88 0.5
GeomTile NA NA grey20 NA 1 0.1 NA
GeomViolin NA grey20 white solid 0.5 1
GeomVline NA black 1 0.5

Made with the following code:

library(tidyverse)

geom_names <- apropos("^Geom", ignore.case = FALSE)
geoms <- mget(geom_names, env = asNamespace("ggplot2"))
aes_list <- lapply(geoms, function(x) x$default_aes)

clean <- aes_list %>% map(., unclass) %>% discard(is_empty) 

aes_table <- clean %>%
  map_df(., function(x) {
    rbind(x) %>% data.frame(.) %>% mutate_all(., as.character)
  }) %>%
  mutate(geom = names(clean)) %>%
  gather(., key = aes, value = value, -geom, na.rm = T) %>%
  arrange(geom)
  
aes_table_wide <- aes_table %>% 
  spread(., aes, value) %>% 
  replace(., is.na(.), "") %>% 
  knitr::kable(format = "markdown")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment