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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 作者:严涛浙江大学作物遗传育种在读研究生(生物信息学方向)伪码农,R语言爱好者,爱开源 ggplot2学习笔记之图...
    Dylan的迪阅读 2,698评论 0 6
  • 本笔记内容:最近工作中遇到的分析需求:按照要求的分组画boxplot和PcoA的散点图。对画各种图的实现方法,一些...
    GPZ_Lab阅读 14,446评论 0 18
  • 坐标轴 参考 http://blog.csdn.net/bone_ace/article/details/4742...
    _CelesteHuang_阅读 1,069评论 0 1
  • 写在前面 ggplot2 是一个功能强大且灵活的R包 ,由Hadley Wickham 编写,其用于生成优雅的图...
    Boer223阅读 28,305评论 0 67
  • ggplot2的基本原理和使用方法 ggplot2是R语言第三方可视化扩展包,在某种程度上它基本代替了R可视化。该...
    生信学习者2阅读 1,582评论 0 1