A highly conserved core bacterial microbiota with nitrogen-fixation capacity inhabits the xylem sap in maize plants
https://www.nature.com/articles/s41467-022-31113-w
本地pdf s41467-022-31113-w.pdf
https://github.com/PlantNutrition/Liyu
今天的推文我们重复一下论文中的Figure2f
image.png
这个图怎们看,然后表达的是什么含义,我暂时还想不明白,论文中给的图注是
Ternary plots of OTUs in xylem sap across three fertilisation treatments. Size of each point represents relative abundance of OTU. Position is determined by the contribution of three fertilisation treatments to the total relative abundance, proximity to that vertex indicates enrichment of that OTU in that fertilisation treatment. Colours of circles correspond to different genera. Grey circles indicate OTUs with no significant differences in abundance.
image.png
ggtern 这个R包是我第一次使用,首先需要安装,运行代码install.packages("ggtern")
plot_data <- read.table("data/20220612/Tern_data.txt",
header=T,
row.names= 1,
sep="\t",
comment.char = "")
library(ggtern)
p <- ggtern(data=plot_data, aes(x=CK, y=NPK, z=NPKM)) +
geom_mask() +
geom_point(aes(size=size, color=Genus),alpha=0.8) +
scale_size(range = c(0, 10)) +
scale_color_manual(values = c('#E31A1C','#228B22','#1F78B4', '#FDB462', '#8B658B', '#4876FF', '#00BFFF', '#EE82EE','#8B8682','#CDC9C9'), limits = c('Klebsiella','Pseudomonas','Enterobacteriaceae_unclassified','Rosenbergiella','Oxalobacteraceae_unclassified','Sphingobacterium','Lactococcus','Erwinia','Others','NotSig')) +
guides(size="none") +theme_bw() +
theme(axis.text=element_blank(), axis.ticks=element_blank())
p
论文中的代码出图
image.png
调整图例的位置,可以用ggplot2中调整图例的方法
p+
theme(legend.position = "bottom")+
guides(color=guide_legend(nrow = 3,
override.aes = list(size = 5),
title.position = "top"))
image.png
试了一下和其他ggplot2的图进行组合,patchwork没有成功,找找有没有其他办法可以实现组合图