Cette réponse détaille toutes les esthétiques, pas seulement celles par défaut.
Obtenir toutes les fonctions de Geom*.
library(tidyverse)
env <- asNamespace("ggplot2")
all_Geoms <- ls(envir = env, pattern = "^Geom.+")
all_Geoms <- mget(all_Geoms, env)
Obtenez toute l'esthétique
all_aes <- map(all_Geoms, ~.$aesthetics())
# change Geom* to geom_*
names(all_aes) <-
names(all_aes) %>%
substr(5,nchar(.)) %>%
tolower() %>%
paste0("geom_",.)
# remove if geom_* doesn't exist
all_aes[!names(all_aes) %in% ls(envir = env)] <- NULL
head(all_aes, 3)
#> $geom_abline
#> [1] "slope" "intercept" "colour" "size" "linetype" "alpha"
#> [7] "group"
#>
#> $geom_area
#> [1] "x" "y" "colour" "fill" "size" "linetype"
#> [7] "alpha" "group"
#>
#> $geom_bar
#> [1] "x" "y" "colour" "fill" "size" "linetype"
#> [7] "alpha" "group"
disposés sur une longue table
all_aes_long <- all_aes %>%
enframe("fun","aes") %>%
unchop(aes)
all_aes_long
#> # A tibble: 325 x 2
#> fun aes
#> <chr> <chr>
#> 1 geom_abline slope
#> 2 geom_abline intercept
#> 3 geom_abline colour
#> 4 geom_abline size
#> 5 geom_abline linetype
#> 6 geom_abline alpha
#> 7 geom_abline group
#> 8 geom_area x
#> 9 geom_area y
#> 10 geom_area colour
#> # ... with 315 more rows
disposés dans une large table
Je suggère d'utiliser View()
pour visualiser celle-ci.
all_aes_wide <-
all_aes_long%>%
mutate(val = 1) %>%
spread(aes,val,fill = 0)
all_aes_wide
#> # A tibble: 38 x 38
#> fun alpha angle colour family fill fontface geometry group height
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 geom~ 1 0 1 0 0 0 0 1 0
#> 2 geom~ 1 0 1 0 1 0 0 1 0
#> 3 geom~ 1 0 1 0 1 0 0 1 0
#> 4 geom~ 0 0 0 0 0 0 0 1 0
#> 5 geom~ 1 0 1 0 1 0 0 1 0
#> 6 geom~ 1 0 1 0 1 0 0 1 0
#> 7 geom~ 1 0 1 0 0 0 0 1 0
#> 8 geom~ 1 0 1 0 1 0 0 1 0
#> 9 geom~ 1 0 1 0 0 0 0 1 0
#> 10 geom~ 1 0 1 0 1 0 0 1 0
#> # ... with 28 more rows, and 28 more variables: hjust <dbl>,
#> # intercept <dbl>, label <dbl>, lineheight <dbl>, linetype <dbl>,
#> # lower <dbl>, map_id <dbl>, middle <dbl>, radius <dbl>, shape <dbl>,
#> # size <dbl>, slope <dbl>, stroke <dbl>, subgroup <dbl>, upper <dbl>,
#> # vjust <dbl>, weight <dbl>, width <dbl>, x <dbl>, xend <dbl>,
#> # xintercept <dbl>, xmax <dbl>, xmin <dbl>, y <dbl>, yend <dbl>,
#> # yintercept <dbl>, ymax <dbl>, ymin <dbl>
bonus : fréquence des aes
table(all_aes_long$aes)
#>
#> alpha angle colour family fill fontface
#> 37 3 36 2 20 2
#> geometry group height hjust intercept label
#> 1 38 2 2 1 2
#> lineheight linetype lower map_id middle radius
#> 2 33 1 1 1 1
#> shape size slope stroke subgroup upper
#> 4 35 1 4 2 1
#> vjust weight width x xend xintercept
#> 2 6 2 30 2 1
#> xmax xmin y yend yintercept ymax
#> 2 2 27 2 1 8
#> ymin
#> 8