生信绘图那些年画图的简便操作

ggplot2给标签添加上下标

2021-05-25  本文已影响0人  R语言数据分析指南

本节介绍通过bquote函数给图标签添加上下标

library(tidyverse)
library(patchwork)
iris %>% as_tibble()
   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
          <dbl>       <dbl>        <dbl>       <dbl> <fct>  
 1          5.1         3.5          1.4         0.2 setosa 
 2          4.9         3            1.4         0.2 setosa 
 3          4.7         3.2          1.3         0.2 setosa 
 4          4.6         3.1          1.5         0.2 setosa 
 5          5           3.6          1.4         0.2 setosa 
p1 <- iris %>% as_tibble() %>% 
  ggplot(aes(Sepal.Length,Sepal.Width,fill=Species))+
  geom_point(size=4,pch=21,color="white")+
  xlab(bquote(CO[2]^-2))
p2 <- iris %>% as_tibble() %>% 
  ggplot(aes(Sepal.Length,Sepal.Width,fill=Species))+
  geom_point(size=4,pch=21,color="white")+
  xlab(bquote(Assimilation (mu~ mol ~CO[2]~ m^-2~s^-1)))
p1+p2+plot_layout(guides = 'collect')

欢迎关注我的公众号

R语言数据分析指南

本公众号主要分享数据可视化的一些经典案例及一些生信相关的知识供大家学习

上一篇 下一篇

猜你喜欢

热点阅读