导语
韦恩图用于展示在不同的事物群组(集合)之间的数学或逻辑联系,尤其适合用来表示集合(或)类之间的“大致关系”,它也常常被用来帮助推导(或理解推导过程)关于集合运算(或类运算)的一些规律。
下面介绍运用ggVennDiagram包绘制简单美观的韦恩图。
install.packages("ggVennDiagram")
library(ggVennDiagram)
venn <- read.csv("venn_data.csv",header=T)
venn_list <- list(BL=venn[,1],RB=venn[,2],RL=venn[,3])
ggVennDiagram(venn_list,edge_size=1,set_size = 6,size=5,label_alpha=0,label_size=4,category.names = c("BL","RB","RL")) + scale_fill_gradient(low="white",high = "red")
韦恩图
#参数
Arguments
category.names
#default is names(x)
show_intersect
#if TRUE the text can be visualized by `plotly`
set_color
#color of set labels ("black")
set_size
#size of set labels (NA)
label
#format of region labels, select one from c("count","percent","both","none")
label_alpha
#set 0 to remove the background of region labels
label_geom
#layer of region labels, choose from c("label", "text")
label_color
#color of region labels ("black")
label_size
#size of region labels (NA)
label_percent_digit
#number of digits when formatting percent label (0)
label_txtWidth
#width of text used in showing intersect members, will be ignored unless show_intersection is TRUE (40)
edge_lty
#line type of set edges ("solid")
edge_size
#line width of set edges (1)
网友评论