R语言包lemon

具体都有什么作用暂时还不知道,可以操作ggplot2作图的坐标轴,比如下图

dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
library(lemon)
library(ggplot2)
p <- ggplot(dsamp, aes(x=cut, y=price, colour=clarity)) + 
  geom_point(position=position_jitter(width=0.2)) +
  coord_flex_cart(bottom=brackets_horizontal(), 
                  left=capped_vertical('none')) +
  theme_bw() + 
  theme(panel.border=element_blank(), 
        axis.line = element_line(),
        legend.background = element_rect(colour='grey'))
p
image.png

他把X轴的坐标轴调整成了这个形式,让我想我还真不知道如何实现的,它这里边借助的函数是coord_flex_cart()用到的时候再来研究吧

还有函数可以操作图例

g <- reposition_legend(p, 'top left', plot=TRUE)
image.png

对应的github主页

https://github.com/stefanedwards/lemon

比较详细的帮助文档

https://cran.r-project.org/web/packages/lemon/vignettes/legends.html#complex-layout-with-grid_arrange_shared_legend

欢迎大家关注我的公众号
小明的数据分析笔记本

小明的数据分析笔记本 公众号 主要分享:1、R语言和python做数据分析和数据可视化的简单小例子;2、园艺植物相关转录组学、基因组学、群体遗传学文献阅读笔记;3、生物信息学入门学习资料及自己的学习笔记!

你可能感兴趣的:(R语言包lemon)