ggplot2 legend

ggplot_build

ggplot_build() takes the plot object, and performs all steps necessary to produce an object that can be rendered.

  1. plot data
  2. panel object
p <- ggplot() + geom_density(data = mtcars, aes(x = mpg, fill = "color1")) + 
    geom_density(data = mpg, aes(x = hwy, fill = "color2"))
ggplot_build(p)

Point size

guides(colour = guide_legend(override.aes = list(size=5)))
guides(alpha = guide_legend(override.aes = list(size=5, fill = 'black')))
image.png
image.png
image.png

Math Symbols and Expressions

  1. https://www.benjaminackerman.com/post/2019-03-08-equation_labels/
  2. https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/plotmath.html

你可能感兴趣的:(ggplot2 legend)