100天生信-Day8
箱线图绘制代码记录:
install.packages('patchwork')
library(ggplot2)
library(patchwork)
setwd("/Users/lichuanshun/Documents/project/1_R_plot/")
rm(list = ls())
self <- read.csv('kaks_self.csv', header = T)
At <- read.csv('kaks_At.csv', header = T)
Br <- read.csv('kaks_Br.csv', header = T)
colnames(self)
p1<- ggplot(self, aes(x=type, y=Ka_Ks, fill = type)) +
geom_boxplot() +
scale_fill_manual(values=c("#E64B35FF", "#4DBBD5FF", "#00A087FF")) +
geom_dotplot(binaxis='y', stackdir='center', stackratio=1.5, dotsize=0.5) +
theme_classic()
p2 <- ggplot(At, aes(x=type, y=Ka_Ks, fill = type)) +
geom_boxplot() +
scale_fill_manual(values=c("#E64B35FF", "#4DBBD5FF", "#00A087FF")) +
geom_dotplot(binaxis='y', stackdir='center', stackratio=1.5, dotsize=0.5) +
theme_classic()
p3 <- ggplot(Br, aes(x=type, y=Ka_Ks, fill = type)) +
geom_boxplot() +
scale_fill_manual(values=c("#E64B35FF", "#4DBBD5FF", "#00A087FF")) +
geom_dotplot(binaxis='y', stackdir='center', stackratio=1.5, dotsize=0.5) +
theme_classic()
## 使用patchwork组图
(p1 | p2 | p3)