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