R語言繪圖是生信技能樹生信爆款入門課程R語言部分Day6的講到的一個重要知識點才避。
為加深理解频祝,現(xiàn)在做下練習鞏固旷赖。
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 繪制發(fā)表級別圖片
if(!require(ggpubr))install.packages('ggpubr')
library(ggpubr)
ggscatter(iris,
x="Sepal.Length",
y="Petal.Length",
color="Species")
image.png