science组合图表第二次重大升级了
写在前面:这两天好多人在群里讨论这个图形,这样啦,那样啦,你们讨论我就看得到。今天ppt做的脑子也涨的慌,翻了翻群聊天记录,发现了你们的需求。基于这些总结起来就一句话:
我们不要全部连线,我们要改变图形方向。 So·····本次升级就来了 ,你们难道不得给小编点个好看吗?来吧!
本次升级内容包括:
基于一些相关性不显著的变量,我们不想要群落矩阵和环境变量之间的连线,所以这里我设置了参数,sub,用于挑选需要展示连线的环境因子。
有朋友总在询问是否可以将图形换一个布局,换一个方向,也就是连线在三角矩阵下面,三角矩阵变换为上三角。这次我也更新了,大家加油尝试吧
备注:本次更新使用数据不变,大家使用之前数据即可。只需要更换代码函数。
这次是两个函数,其实我想把两个函数放一起的,但是嵌套太多,明天汇报,所以就将两个不同方向的组合组表拆分为两个函数了。大家见谅,毕竟我还有第三次升级,第三次升级重点在改变颜色和标签图例等细节内容,大家有兴趣可以自己修改,发给小编进行交流。
载入函数
source("./plot_mantel_cor_4_more.R")
本次添加参数sub1,一共有四个,分别是指定需要连接的变量,这里我指定"env7","env8","env4"这三个变量连接。
report = read.csv("./report.csv",row.names = 1)
sub1 = c("env7","env8","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A"),sub1 = sub1 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
# report$bb = report$R
head(report)
##下面我们指定每个矩阵需要和那些env相连接
# 注意ggplot不可以使用使用不同的数据框,但是相同的数据狂名称
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B"),sub1 = sub1,sub2 = sub2 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
report$bb = report$R
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
sub3 = c("env11","env6","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B","C"),sub1 = sub1,sub2 = sub2 ,sub3 = sub3 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
report$bb = report$R
report$cc = report$R
report
##下面我们指定每个矩阵需要和那些env相连接
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
sub3 = c("env11","env6","env4")
sub4 = c("env7","env6","env10","env12")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B","C","D") ,sub1 = sub1,sub2 = sub2 ,sub3 = sub3,sub4 = sub4)
p
换一个方向
载入函数
source("./plot_mantel_cor_4_more.R")
report = read.csv("./report.csv",row.names = 1)
sub1 = c("env7","env8","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A"),sub1 = sub1 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
# report$bb = report$R
head(report)
##下面我们指定每个矩阵需要和那些env相连接
# 注意ggplot不可以使用使用不同的数据框,但是相同的数据狂名称
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B"),sub1 = sub1,sub2 = sub2 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
report$bb = report$R
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
sub3 = c("env11","env6","env4")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B","C"),sub1 = sub1,sub2 = sub2 ,sub3 = sub3 )
p
report = read.csv("./report.csv",row.names = 1)
report$aa = report$R
report$bb = report$R
report$cc = report$R
report
##下面我们指定每个矩阵需要和那些env相连接
sub1 = c("env7","env8","env4")
sub2 = c("env5","env10","env4")
sub3 = c("env11","env6","env4")
sub4 = c("env7","env6","env10","env12")
p = plot_mantel_cor_3_more(env = env.st,report = report,title = c("A","B","C","D") ,sub1 = sub1,sub2 = sub2 ,sub3 = sub3,sub4 = sub4)
p