输入数据
数据预处理
排序,设因子,melt
library(ggplot2)
library(reshape2)
df3 = df3[order(df3$Richness, decreasing=F),]
df3$Sample = factor(df3$Sample, levels = df3$Sample)
input = melt(df3, id='Sample')
ggplot画图
p=
ggplot(input, aes(x=Sample, y=value, color=variable)) +
geom_point() +
geom_line(aes(group=variable)) +
labs(y="Number", color="") +
theme_classic() +
theme(axis.title = element_text(size = 15),
axis.text = element_text(size = 13),
axis.text.x = element_text(angle = 60, hjust = 1),
axis.line = element_line(size = 1),
axis.ticks = element_line(size = 1),
title = element_text(size = 12))
ggsave(p, file="tmp.png")













网友评论