本文主要是介绍笔记—R语言做upset交集图,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#不适合样本数量太多
install.packages("UpSetR")
library(UpSetR)
library(dplyr)
library(tidyr)
library(ggplot2)
library(plyr)
library(gridExtra)
library(grid)
require(ggplot2); require(plyr); require(gridExtra); require(grid);
#直接输入
input <- c("0m" = 54,"25m" = 58,"50m" = 64, "117m" =
63, "150m" = 57, "200m" = 50,
"0m&25m" = 42,"0m&50m" = 38,"0m&117m" = 38,
"0m&150m" = 32,"0m&200m" = 32,
"25m&50m" = 42, "25m&117m" = 40, "25m&150m" = 36,"25m&200m"=35,
"50m&117m"= 44,"50m&150m" = 40,"50m&200m" = 38,"117m&150m" = 40,"117m&200m" = 38,"150m&200m" = 38,
"0m&25m&50m" = 34,"0m&25m&117m"= 33,"0m&25m&150m" = 29,
"0m&25m&200m" = 30,"25m&50m&117m" = 36,"25m&50m&150m" = 35,"25m&50m&200m" = 33,"50m&117m&150m"=34,"50m&117m&200m"=34,
"117m&150m&200m"= 33,
"0m&25m&50m&117m" = 29,"0m&25m&50m&150m"= 28,
"0m&25m&50m&200m" = 28,"0m&50m&117m&150m" = 28,"0m&50m&117m&200m" = 26,"0m&117m&150m&200m"= 27,
"25m&50m&117m&150m"=32,"25m&50m&117m&200m"=31,"25m&117m&150m&200m"=31,"50m&117m&150m&200m"=30,
"0m&25m&50m&117m&150m" = 26,
"0m&25m&50m&117m&200m" = 26,"25m&50m&117m&150m&200m" = 30,
"0m&25m&50m&117m&150m&200m" = 26)
install.packages("venneuler")
install.packages("rJava")
library(rJava)
library(venneuler)
data <- fromExpression(input)#转换成upset包可用的形式
upset(data, nsets = 9,mb.ratio = c(0.6, 0.4), order.by = "freq",
nintersects = 50,#显示多少个交集
mainbar.y.label = "Intersection Size",
sets.x.label = "Subset Size",
main.bar.color = "#99CCFF",#柱状图颜色
sets.bar.color ="#99CCFF", #交集颜色
matrix.color = "#FF9999",#交集圆点颜色
scale.sets = "identity",
text.scale =c(2,1.5,1.5,1.5,1.5,1) )
这篇关于笔记—R语言做upset交集图的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!