venn.diagram(VennDiagram)
venn.diagram()所属R语言包:VennDiagram
Make a Venn Diagram
维恩图
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function takes a list and creates a publication-quality TIFF Venn Diagram
这个函数接受一个列表,并创建一个出版物质量的TIFF维恩图
用法----------Usage----------
venn.diagram(x, filename, height = 3000, width = 3000, resolution = 500, units = "px", compression = "lzw", na = "stop", main = "", sub = "", main.pos = c(0.5, 1.05), main.fontface = "plain", main.fontfamily = "serif", main.col = "black", main.cex = 1, main.just = c(0.5, 1), sub.pos = c(0.5, 1.05), sub.fontface = "plain", sub.fontfamily = "serif", sub.col = "black", sub.cex = 1, sub.just = c(0.5, 1), category.names = names(x), ...);
参数----------Arguments----------
参数:x
A list of vectors (e.g., integers, chars), with each component corresponding to a separate circle in the Venn diagram
向量的列表(例如,整数,字符),与对应于一个单独的循环在维恩图中的每个组件
参数:filename
Filename for tiff output, or if NULL returns the grid object itself
TIFF输出的文件名,或者NULL返回网格对象本身
参数:height
Integer giving the height of the output figure in units
整数,给出单元的输出的数字中的高度
参数:width
Integer giving the width of the output figure in units
整数,输出数字的宽度单位
参数:resolution
Resolution of the final figure in DPI
最后的数字,在分辨率DPI
参数:units
Size-units to use for the final figure
大小单位使用,最后的数字
参数:compression
What compression algorithm should be applied to the final tiff
应施加到最终的TIFF压缩算法
参数:na
Missing value handling method: "none", "stop", "remove"
缺失值处理方法:“无”,“停止”,“删除”
参数:main
Character giving the main title of the diagram
主标题的字符的图
参数:sub
Character giving the subtitle of the diagram
字符字幕的图
参数:main.pos
Vector of length 2 indicating (x,y) of the main title
向量的长度为2表示(的x,y)的主标题
参数:main.fontface
Character giving the fontface (font style) of the main title
字符给fontface(主标题字体样式)
参数:main.fontfamily
Character giving the fontfamily (font type) of the main title
字符的FontFamily(字体)的主标题
参数:main.col
Character giving the colour of the main title
字符主标题的颜色
参数:main.cex
Number giving the cex (font size) of the main title
号码给主标题的CEX(字体大小)
参数:main.just
Vector of length 2 indicating horizontal and vertical justification of the main title
向量的长度为2,表示水平和垂直对齐的主标题
参数:sub.pos
Vector of length 2 indicating (x,y) of the subtitle
向量的长度为2表示(的x,y)的字幕
参数:sub.fontface
Character giving the fontface (font style) of the subtitle
字符的fontface(字体样式)的字幕
参数:sub.fontfamily
Character giving the fontfamily (font type) of the subtitle
字符给予的FontFamily(字体类型)的字幕
参数:sub.col
Character Colour of the subtitle
字符颜色的字幕
参数:sub.cex
Number giving the cex (font size) of the subtitle
编号给予CEX(字体大小)的字幕
参数:sub.just
Vector of length 2 indicating horizontal and vertical justification of the subtitle
向量的长度为2,表示水平和垂直对齐的字幕
参数:category.names
Allow specification of category names using plotmath syntax
允许使用plotmath语法规范的类别名称
参数:...
A series of graphical parameters tweaking the plot. See below for details
一系列图形参数调整的图。有关详细信息,请参阅下面的
Details
详细信息----------Details----------
值----------Value----------
Plots a figure to the file given by the <VAR>filename</VAR> argument.
绘制一个图</ VAR>参数的<VAR>文件名的文件。
(作者)----------Author(s)----------
Hanbo Chen
参见----------See Also----------
draw.single.venn, draw.pairwise.venn, draw.triple.venn, draw.quad.venn
draw.single.venn,draw.pairwise.venn,draw.triple.venn,draw.quad.venn
实例----------Examples----------
# compact and minimal notation[结构紧凑,最小的符号]
venn.diagram(list(A = 1:150, B = 121:170), "Venn_2set_simple.tiff");
venn.diagram(list(A = 1:150, B = 121:170, C = 101:200), "Venn_3set_simple.tiff");
# a more elaborate two-set Venn diagram with title and subtitle[一个更详细的维恩图,标题和副标题两盘]
venn.diagram(
x = list(
"A" = 1:100,
"B" = 96:140
),
filename = "Venn_2set_complex.tiff",
scaled = TRUE,
ext.text = TRUE,
ext.line.lwd = 2,
ext.dist = -0.15,
ext.length = 0.9,
ext.pos = -4,
inverted = TRUE,
cex = 2.5,
cat.cex = 2.5,
rotation.degree = 45,
main = "Complex Venn Diagram",
sub = "Featuring: rotation and external lines",
main.cex = 2,
sub.cex = 1
);
venn.diagram(
x = list(
"Num A" = paste("Num", 1:100),
"Num B" = c(paste("Num", 61:70), paste("Num", 71:100)),
"Num C" = c(paste("Num", 41:60), paste("Num", 61:70))),
euler.d = TRUE,
filename = "Euler_3set_simple.tiff",
cat.pos = c(-20, 0, 20),
cat.dist = c(0.05, 0.05, 0.02),
cex = 2.5,
cat.cex = 2.5,
reverse = TRUE
);
venn.diagram(
x = list(
A = c(1:10),
B = c(11:90),
C = c(81:90)
),
euler.d = TRUE,
filename = "Euler_3set_scaled.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = 0
);
venn.diagram(
x = list(
A = c(1:60, 61:105, 106:140, 141:160, 166:175, 176:180, 181:205, 206:220),
D = c(531:605, 476:530, 336:375, 376:405, 181:205, 206:220, 166:175, 176:180),
B = c(61:105, 106:140, 181:205, 206:220, 221:285, 286:335, 336:375, 376:405),
C = c(406:475, 286:335, 106:140, 141:160, 166:175, 181:205, 336:375, 476:530)
),
filename = "Venn_4set_pretty.tiff",
col = "transparent",
fill = c("cornflowerblue", "green", "yellow", "darkorchid1"),
alpha = 0.50,
label.col = c("orange", "white", "darkorchid4", "white", "white", "white", "white", "white", "darkblue", "white", "white", "white", "white", "darkgreen", "white"),
cex = 1.5,
fontfamily = "serif",
fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),
cat.cex = 1.5,
cat.pos = 0,
cat.dist = 0.07,
cat.fontfamily = "serif",
rotation.degree = 270,
margin = 0.2
);
# Figure 1A[图1A]
venn.diagram(
x = list(
Label = 1:100
),
filename = "1A-single_Venn.tiff",
col = "black",
lwd = 9,
fontface = "bold",
fill = "grey",
alpha = 0.75,
cex = 4,
cat.cex = 3,
cat.fontface = "bold",
);
# Figure 1B[图1B]
venn.diagram(
x = list(
X = 1:150,
Y = 121:180
),
filename = "1B-double_Venn.tiff",
lwd = 4,
fill = c("cornflowerblue", "darkorchid1"),
alpha = 0.75,
label.col = "white",
cex = 4,
fontfamily = "serif",
fontface = "bold",
cat.col = c("cornflowerblue", "darkorchid1"),
cat.cex = 3,
cat.fontfamily = "serif",
cat.fontface = "bold",
cat.dist = c(0.03, 0.03),
cat.pos = c(-20, 14)
);
# Figure 1C[图1C]
venn.diagram(
x = list(
R = c(1:70, 71:110, 111:120, 121:140),
B = c(141:200, 71:110, 111:120, 201:230),
G = c(231:280, 111:120, 121:140, 201:230)
),
filename = "1C-triple_Venn.tiff",
col = "transparent",
fill = c("red", "blue", "green"),
alpha = 0.5,
label.col = c("darkred", "white", "darkblue", "white", "white", "white", "darkgreen"),
cex = 2.5,
fontfamily = "serif",
fontface = "bold",
cat.default.pos = "text",
cat.col = c("darkred", "darkblue", "darkgreen"),
cat.cex = 2.5,
cat.fontfamily = "serif",
cat.dist = c(0.06, 0.06, 0.03),
cat.pos = 0
);
# Figure 1D[图1D]
venn.diagram(
x = list(
I = c(1:60, 61:105, 106:140, 141:160, 166:175, 176:180, 181:205, 206:220),
IV = c(531:605, 476:530, 336:375, 376:405, 181:205, 206:220, 166:175, 176:180),
II = c(61:105, 106:140, 181:205, 206:220, 221:285, 286:335, 336:375, 376:405),
III = c(406:475, 286:335, 106:140, 141:160, 166:175, 181:205, 336:375, 476:530)
),
filename = "1D-quadruple_Venn.tiff",
col = "black",
lty = "dotted",
lwd = 4,
fill = c("cornflowerblue", "green", "yellow", "darkorchid1"),
alpha = 0.50,
label.col = c("orange", "white", "darkorchid4", "white", "white", "white", "white", "white", "darkblue", "white", "white", "white", "white", "darkgreen", "white"),
cex = 2.5,
fontfamily = "serif",
fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),
cat.cex = 2.5,
cat.fontfamily = "serif"
);
# Figure 2-1[图2-1]
venn.diagram(
x = list(
A = 1:105,
B = 101:115
),
filename = "2-1_special_case_ext-text.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = c(-20, 20),
ext.line.lty = "dotted",
ext.line.lwd = 2,
ext.pos = 12,
ext.dist = -0.12,
ext.length = 0.85
);
# Figure 2-2[图2-2]
venn.diagram(
x = list(
A = 1:100,
B = 1:10
),
filename = "2-2_special_case_pairwise-inclusion.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = 0
);
# Figure 2-3[图2-3]
venn.diagram(
x = list(
A = 1:150,
B = 151:250
),
filename = "2-3_special_case_pairwise-exclusion.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = c(0, 0),
cat.dist = 0.05
);
# Figure 2-4[图2-4]
venn.diagram(
x = list(
A = c(1:50, 101:140, 141:160, 161:170),
B = c(171:230, 101:140, 161:170, 291:320),
C = c(141:160, 161:170, 291:320)
),
sp.cases = TRUE,
filename = "2-4_triple_special_case-001.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.dist = c(0.05, 0.05, -0.1)
);
# Figure 2-5[图2-5]
venn.diagram(
x = list(
A = c(1:100),
B = c(61:70, 71:100),
C = c(41:60, 61:70)
),
sp.cases = TRUE,
filename = "2-5_triple_special_case-012AA.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = c(-25, 0, 30),
cat.dist = c(0.05, 0.05, 0.02)
);
# Figure 2-6[图2-6]
venn.diagram(
x = list(
A = c(1:90),
B = c(1:25),
C = c(1:5)
),
sp.cases = TRUE,
filename = "2-6_triple_special_case-022AAAO.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = 0,
cat.dist = c(0.03, 0.03, 0.01)
);
# Figure 2-7[图2-7]
venn.diagram(
x = list(
A = c(1:20),
B = c(21:80),
C = c(81:210)
),
sp.cases = TRUE,
filename = "2-7_triple_special_case-100.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.dist = 0.05
);
# Figure 2-8[图2-8]
venn.diagram(
x = list(
A = c(1:80),
B = c(41:150),
C = c(71:100)
),
sp.cases = TRUE,
filename = "2-8_triple_special_case-011A.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.dist = c(0.07, 0.07, 0.02),
cat.pos = c(-20, 20, 20)
);
# Figure 2-9[图2-9]
venn.diagram(
x = list(
A = c(1:10),
B = c(11:90),
C = c(81:90)
),
sp.cases = TRUE,
filename = "2-9_triple_special_case-121AO.tiff",
cex = 2.5,
cat.cex = 2.5,
cat.pos = 0,
cat.dist = c(0.04, 0.04, 0.02),
reverse = TRUE
);
# Figure 3-1 [图3-1]
venn.diagram(
x = list(
I = c(1:60, 61:105, 106:140, 141:160, 166:175, 176:180, 181:205, 206:220),
II = c(531:605, 476:530, 336:375, 376:405, 181:205, 206:220, 166:175, 176:180),
III = c(61:105, 106:140, 181:205, 206:220, 221:285, 286:335, 336:375, 376:405)
),
category.names = c(
expression( bold('A'['1: subscript']) ),
expression( bold('B'^'2: going up') ),
expression( paste(bold('C'^'3'), bold('X'['i' <= 'r'^'2']^'2') ) )
),
filename = 'Fig3-1_triple_labels_sub_and_superscripts.tiff',
output = TRUE,
height = 3000,
width = 3000,
resolution = 300,
compression = 'lzw',
units = 'px',
lwd = 6,
lty = 'blank',
fill = c('yellow', 'purple', 'green'),
cex = 3.5,
fontface = "bold",
fontfamily = "sans",
cat.cex = 3,
cat.fontface = "bold",
cat.default.pos = "outer",
cat.pos = c(-27, 27, 135),
cat.dist = c(0.055, 0.055, 0.085),
cat.fontfamily = "sans",
rotation = 1
);
# Figure 3-2 [图3-2]
venn.diagram(
x = list(
"Num A" = paste("Num", 1:100),
"Num B" = c(paste("Num", 61:70), paste("Num", 71:100)),
"Num C" = c(paste("Num", 41:60), paste("Num", 61:70))),
category.names = c(
expression( bold('A'['1']) ),
expression( bold('A'['2']) ),
expression( bold('A'['3']) )
),
euler.d = TRUE,
filename = "Fig3-2_Euler_3set_simple_with_subscripts.tiff",
cat.pos = c(-20, 0, 20),
cat.dist = c(0.05, 0.05, 0.02),
cex = 2.5,
cat.cex = 2.5,
reverse = TRUE
);
## Not run: [#不运行:]
# Example to print to screen [举个例子来打印到屏幕]
venn.plot <- venn.diagram(
x = list(
sample1 = c(1:40),
sample2 = c(30:60)
),
filename = NULL
);
grid.draw(venn.plot);
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|