Is there a table or catalog of aesthetics for ggplot2?

I am new to ggplot2 and trying to find an exhaustive list of aesthetics. I think that I understand their purpose, but it is difficult to understand what can be used in various situations (mainly geometry?). Hadley's website sometimes lists the available aesthetics on the pages for individual geomes, and R doc sometimes (though less often) does the same. I even found geometry for which the two do not quite match.

I looked through the comments here for an answer and even bought a book! Alas, no help.

I think it would be fantastic to have a table with all the aesthetics listed in one dimension, and all geomes (and other objects?) Listed in another.

Does anyone know about this?

Is there an easy way (command) in R to display all the aesthetics that can be applied to an object?

Here's how the table might start:

List xy fill size colour linetype . . . geom_point Yes Yes Yes Yes Yes No geom_abline Yes Yes No Yes Yes Yes . . . 

A catalog of aesthetic definitions / parameters will also be a useful link.

+50
r ggplot2
Jul 25 2018-12-25T00:
source share
2 answers

Below is default_aes for each geometry,

  colour size linetype alpha fill weight shape width height angle hjust vjust family fontface lineheight abline black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- area yes 0.5 1 yes grey20 -- -- -- -- -- -- -- -- -- -- bar yes 0.5 1 yes grey20 1 -- -- -- -- -- -- -- -- -- bin2d yes 0.5 1 yes grey60 1 -- -- -- -- -- -- -- -- -- boxplot grey20 0.5 solid yes white 1 16 -- -- -- -- -- -- -- -- contour #3366FF 0.5 1 yes -- 1 -- -- -- -- -- -- -- -- -- crossbar black 0.5 1 yes yes -- -- -- -- -- -- -- -- -- -- density black 0.5 1 yes yes 1 -- -- -- -- -- -- -- -- -- density2d #3366FF 0.5 1 yes -- 1 -- -- -- -- -- -- -- -- -- errorbar black 0.5 1 yes -- -- -- 0.5 -- -- -- -- -- -- -- errorbarh black 0.5 1 yes -- -- -- -- 0.5 -- -- -- -- -- -- freqpoly black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- hex yes 0.5 -- yes grey50 -- -- -- -- -- -- -- -- -- -- hline black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- linerange black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- path black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- point black 2 -- yes yes -- 16 -- -- -- -- -- -- -- -- pointrange black 0.5 1 yes yes -- 16 -- -- -- -- -- -- -- -- polygon NA 0.5 1 yes grey20 -- -- -- -- -- -- -- -- -- -- quantile #3366FF 0.5 1 yes -- 1 -- -- -- -- -- -- -- -- -- raster -- -- -- yes grey20 -- -- -- -- -- -- -- -- -- -- rect yes 0.5 1 yes grey20 -- -- -- -- -- -- -- -- -- -- ribbon yes 0.5 1 yes grey20 -- -- -- -- -- -- -- -- -- -- rug black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- segment black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- smooth #3366FF 0.5 1 0.4 grey60 1 -- -- -- -- -- -- -- -- -- step black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- text black 5 -- yes -- -- -- -- -- 0 0.5 0.5 1 1.2 tile yes 0.1 1 yes grey20 -- -- -- -- -- -- -- -- -- -- violin grey20 0.5 solid yes white 1 -- -- -- -- -- -- -- -- -- vline black 0.5 1 yes -- -- -- -- -- -- -- -- -- -- -- 

and the ugly code I used to crack,

 find_aes <- function(geom="point"){ tryCatch({ Geom <- getFromNamespace(paste("Geom", ggplot2:::firstUpper(geom), sep=""), "ggplot2") tmp <- unclass(Geom$default_aes) tmp[is.na(tmp)] <- "yes" data.frame(tmp, stringsAsFactors=FALSE) }, error = function(e) {}) } funs <- grep("^geom_", ls("package:ggplot2"),val=T) geoms <- gsub("^geom_", "", funs) all <- lapply(geoms, find_aes) names(all) <- geoms relevant <- sapply(all, function(x) !is.null(x) && nrow(x) > 0) library(plyr) results = do.call("rbind.fill",all) rownames(results) <- names(relevant[relevant]) results[is.na(results)] <- "--" options(width=9999) capture.output(print(results), file="aes.txt") 
+96
Jul 27 '12 at 7:32
source share

Check out the Aesthetic Features of Vignette, Hadley Wickham:

This vignette summarizes the various formats that perform the functions of drawing a grid. Most of this information is available scattered throughout the R documentation. This application combines all of this in one place.

+3
Feb 17 '16 at 18:31
source share



All Articles