R语言学习.6---绘图

R语言绘图是生信技能树生信爆款入门课程R语言部分Day6的讲到的一个重要知识点。
为加深理解,现在做下练习巩固。

Last compiled on 01/11/21

1.使用base包绘图

plot(iris[,1],iris[,3],col = iris[,5]) 
image.png
text(6.5,4, labels = 'hello')
image.png
boxplot(iris[,1]~iris[,5])
dev.off()
image.png

2.ggplot2 绘图

test = iris
if(!require(ggplot2))install.packages('ggplot2')
library(ggplot2)
ggplot(data = test)+
  geom_point(mapping = aes(x = Sepal.Length,
                           y = Petal.Length,
                           color = Species))
image.png

3.ggpubr 绘制发表级别图片

if(!require(ggpubr))install.packages('ggpubr')
library(ggpubr)

ggscatter(iris,
          x="Sepal.Length",
          y="Petal.Length",
          color="Species")
image.png
STHDA美图中心:www.sthda.com
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容