我正在使用euler()
中的library(eulerr)
绘制维恩图。我想修改自动绘图输出。
我使用此代码生成图:
VennDiag <- euler(c("A" = 1.8, "B" = 1.5, "C" = 10.6, "A&B" = 0, "B&C" = 3.0,
"A&C" = 1.1, "A&B&C" = 1.2))
plot(VennDiag, counts = TRUE, fontface = "bold", cex=2, fill_alpha=0.7, fill=c("darkgrey", "grey", "lightgrey"),
col="black", lty = 1, lwd = 3, auto.key = F, labels=c("le","Et","Se"))
grid::grid.text("Residual variance: 80.8%", x=0.83, y=0.12, gp=gpar(col="black", fontsize=18, fontface=1))
grid::grid.text("9.6%", x=0.53, y=0.82, gp=gpar(col="black", fontsize=18, fontface=1)) # A = LU
grid::grid.text("7.8%", x=0.19, y=0.62, gp=gpar(col="black", fontsize=18, fontface=1)) # B = Env
grid::grid.text("55.1%", x=0.63, y=0.29, gp=gpar(col="black", fontsize=18, fontface=1)) # C = Space
grid::grid.text("0%", x=0.39, y=0.77, gp=gpar(col="black", fontsize=18, fontface=1)) # AB
grid::grid.text("5.8%", x=0.63, y=0.72, gp=gpar(col="black", fontsize=18, fontface=1)) # AC
grid::grid.text("15.5%", x=0.28, y=0.45, gp=gpar(col="black", fontsize=18, fontface=1)) # BC
grid::grid.text("6.4%", x=0.47, y=0.63, gp=gpar(col="black", fontsize=18, fontface=1)) # ABC
dev.off()
该图如下所示:
我希望看到一些变化:
首先,我想增加自动绘制数字的大小,即&#39; 10.6&#39;,&#39; 1.8&#39;等
其次,我想控制三个圆圈标签的位置。
然后,我想减少总体情节余量,即减少白色。
最后,如何在每次重新绘制图形时阻止图形改变其位置,即避免它在空间中旋转(这会导致手动添加的%数字出现问题)。
这是VennDiag的dput():
> dput(VennDiag)
structure(list(coefficients = structure(c(0.0223077882736185,
-1.10120243622206, 0.21452780830607, 1.57628687088998, 0.499982912317244,
-0.493383431185427, 1.16845462595081, 1.36468343773937, 2.25135806565536
), .Dim = c(3L, 3L), .Dimnames = list(c("A", "B", "C"), c("x",
"y", "r"))), original.values = structure(c(1.8, 1.5, 10.6, 0,
1.1, 3, 1.2), .Names = c("A", "B", "C", "A&B", "A&C", "B&C",
"A&B&C")), fitted.values = structure(c(1.7761271295339, 1.47090356084969,
10.5965224775034, 0.210495232193053, 1.15761484399341, 3.02444455156862,
1.14493593079205), .Names = c("A", "B", "C", "A&B", "A&C", "B&C",
"A&B&C")), residuals = structure(c(0.0238728704661046, 0.0290964391503143,
0.00347752249660971, -0.210495232193053, -0.057614843993411,
-0.0244445515686209, 0.0550640692079498), .Names = c("A", "B",
"C", "A&B", "A&C", "B&C", "A&B&C")), region_error = structure(c(0.00210750878001437,
0.00223107077659614, 0.00533659321579116, 0.0108608821673497,
0.0024375646550976, 0.000198313916472209, 0.0034249601335735), .Names = c("A",
"B", "C", "A&B", "A&C", "B&C", "A&B&C")), diag_error = 0.0108608821673497,
stress = 0.000406841007934756), .Names = c("coefficients",
"original.values", "fitted.values", "residuals", "region_error",
"diag_error", "stress"), class = c("euler", "list"))
答案 0 :(得分:0)
首先,我想增加自动绘制数字的大小,即'10 .6','1.8'等
您可以为counts
参数提供仅用于修改这些标签的选项列表,例如plot(fit, counts = list(cex = 3))
。
其次,我想控制三个圆圈标签的位置。
您可以使用lattice::trellis.focus()
实现此目的,但使用inkscape或illustrator修复此功能可能会更容易。
然后,我想减少总体情节余量,即减少白色。
这种白色有两种来源。第一个是在绘图区域内填充,您可以使用xlim
和ylim
参数进行修改。第二个是绘图周围的填充,您可以使用par.settings
参数进行调整。例如,请参阅this。
最后,如何在每次重新绘制图形时阻止图形改变其位置,即避免它在空间中旋转(这会导致手动添加的%数字出现问题)。
使用set.seed()
。