2017-02-16 16 views
2

ベン図を2つのセットでプロットし、1つのセットが別のセット内に完全に収まるようにしたいとしました。私は、これは難解なトリックのように聞こえるかもしれないが、代わりに2つの同心円で、たとえば、円の位置を調整する方法を、聞かせてこのベン図をプロットするときに円の位置を調整する方法

enter image description here

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); 

のようなRパッケージVenndiagramで図を描くことができ内側の円は外側の円に触れる?

this one hereのようなものです。重複しない要素を1つ追加しました。

Venndiagramパッケージで、円の位置を調整できる引数が見つかりませんでした。

+0

一方が他方を含んでいるのでそれはあまり意味がありません。次のような例があります。https://rstudio-pubs-static.s3.amazonaws.com/13301_6641d73cfac741a59c0a851feb99e98b.htmlおよびhttp://rstudio-pubs-static.s3.amazonaws.com/6401_7582b217798044d3ae87ebbdc47b7562.html – lizzie

+0

@リジー。あなたのコメントをありがとう、はい、あなたが提案したWebをチェックしましたが、引き続きサークルの位置を調整するための議論を見つけることができませんでした。私はポストに追加した例のように重複しない要素を追加することで不正行為をする可能性がありますが... – Jun

答えて

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) 

enter image description here

+0

実際にはテキストに入力ミスがあり、272ではなく273になるはずです。 –

+1

はい、動作します! TKS!ソリューションは私が予想していたよりはるかに複雑です... PS:1つの小さなバンププロット(0:40,0:40、type = "n"、xlab = ""、ylab = ""、main = "Venn Diagram "、xaxt = 'n'、yaxt = 'n') plot.new()のエラー:図の余白が大きすぎる – Jun

+1

しかし、提案された解決策で簡単に解決できますhttp://stackoverflow.com/questions/ 12766166/plot-in-error-in-r-too-large-in-r – Jun

関連する問題