【发布时间】:2019-02-25 16:29:15
【问题描述】:
我努力绘制一个简单的维恩图,但我遇到了我不理解的错误。
与 Rdocumentation 中为 draw.triple.venn 图函数编写的代码相比,我无法弄清楚我的代码(如下)有什么问题 - 我认为代码很好 (https://www.rdocumentation.org/packages/VennDiagram/versions/1.6.20/topics/draw.triple.venn)。
library(VennDiagram)
library(gridExtra)
body(draw.triple.venn)[[78]] <- substitute(cell.labels <- paste0(areas," : ", round( 100*areas/sum(areas), 1), "%"))
# this line of code adds %s to each of the cells in the Venn Diagram
g <- draw.triple.venn(
area1 = 2951,
area2 = 2764,
area3 = 2764,
n12 = 719,
n23 = 807,
n13 = 1034,
n123 = 325,
category = c("Mental Health", "Community", "Social Care"),
fill = c("blue", "red", "green"),
cat.col = c("blue", "red", "green"),
lty = "blank",
euler.d = TRUE,
scaled = TRUE,
cex = 2,
cat.cex = 2);
grid.arrange(gTree(children = g), main = "Breakdown of WSIC Service Users", sub = "By table")
我收到的错误消息,但无法弄清楚它的含义是:
Error in if (max.x - min.x >= max.y - min.y) { :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In sqrt(r1^2 - (l.x.cept.13 - x.centres[1])^2) : NaNs produced
2: In sqrt(r1^2 - (l.x.cept.13 - x.centres[1])^2) : NaNs produced
谢谢!
【问题讨论】:
-
在新的 R 会话中再试一次。当我尝试这个时,我遇到了同样的错误,但是当我使用新的 R 会话时它们就消失了。这可能是与我加载的另一个包的命名空间冲突
-
不幸的是,错误消息仍然存在。我也尝试下载最新版本的 R。不知道您是否介意与我分享输出?
标签: r venn-diagram