我想用两组绘制维恩图,其中一组完全落入另一组。我可以用这个
的R包Venndiagram
绘制一个图表
library(VennDiagram)
grid.newpage();
venn.plot <- draw.pairwise.venn(area1 =467 ,area2 =273 ,cross.area = 273,
category = c("Set1", "Set2"),fill = c("darkorange", "dodgerblue1"),
lty = rep("solid", 2),lwd = c(2,2),col = c("black","black"),cex = 2,cat.cex = 2,cat.pos = c(310, 135),
cat.dist = 0.09,cat.just = list(c(-1, -1), c(1, 1)),
ext.pos = 30,ext.dist = -0.05,
ext.length = 0.85,ext.line.lwd = 2,ext.line.lty = "dashed");
grid.draw(venn.plot);
这可能听起来像是深奥的诡计,但是如何调整圆圈的位置,比方说,而不是两个同心圆,让内圈触及外圈?
像this one here之类的东西。我添加了一个非重叠元素。
我在Venndiagram
包裹中找不到允许我调整圆圈位置的参数。
答案 0 :(得分:1)
您可以使用plotrix
:
library(plotrix)
area1 = 467
area2 = 273
r1 = round(sqrt(area1/pi))
r2 = round(sqrt(area2/pi))
xc = 8
yc = 8
plot(0:40,0:40,type="n",xlab="",ylab="",main="Venn Diagram", xaxt='n', yaxt='n')
draw.circle(xc+r1,yc+r1,r1,border="black", col="orange",lty=1,lwd=1)
draw.circle(xc+2*r1-r2,yc+r1,r2,border="black", col="steelblue",lty=1,lwd=1)
text(xc+2*r1-r2,yc+r1, '272', cex=3)
text(xc+(r1-r2)/2+1,yc+r1, '195', cex=3)
text(xc+r1,yc+2*r1+7, 'Set1', cex=3)
text(xc+r1+r2,1, 'Set2', cex=3)