R维恩图错误 - 三重维恩图
R Venn Diagram error - triple venn diagram
我正在努力绘制一个简单的维恩图,但出现了我无法理解的错误。
与 draw.triple.venn 图函数的 Rdocumentation 中编写的代码相比,我无法弄清楚我的代码(下面)有什么问题 - 我认为代码很好 (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
谢谢!
已报告此问题 here 的错误。我试图重现这个例子,但我得到了同样的错误。如果你愿意尝试我的 nVennR 库,你可以得到这样的图表:
library(nVennR)
myV <- createVennObj(nSets = 3, sNames = c("Mental Health", "Community", "Social Care"), sSizes = c(0, 598, 913, 807, 873, 1034, 719, 325))
myV <- plotVenn(nVennObj = myV, borderWidth = 2, setColors = c('blue', 'red', 'green'))
结果是一个 SVG 文件:
有一些可视化参数,如您在vignette中所见。在那里,您还可以找到 sSizes
中数字的基本原理。
还有其他数据输入模式。最简单的方法是提供包含每组元素的列表列表(您可以在插图开头看到一个示例)。该包会为您计算图中所有区域,然后您可以查询属于每个区域的元素。
我正在努力绘制一个简单的维恩图,但出现了我无法理解的错误。
与 draw.triple.venn 图函数的 Rdocumentation 中编写的代码相比,我无法弄清楚我的代码(下面)有什么问题 - 我认为代码很好 (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
谢谢!
已报告此问题 here 的错误。我试图重现这个例子,但我得到了同样的错误。如果你愿意尝试我的 nVennR 库,你可以得到这样的图表:
library(nVennR)
myV <- createVennObj(nSets = 3, sNames = c("Mental Health", "Community", "Social Care"), sSizes = c(0, 598, 913, 807, 873, 1034, 719, 325))
myV <- plotVenn(nVennObj = myV, borderWidth = 2, setColors = c('blue', 'red', 'green'))
结果是一个 SVG 文件:
有一些可视化参数,如您在vignette中所见。在那里,您还可以找到 sSizes
中数字的基本原理。
还有其他数据输入模式。最简单的方法是提供包含每组元素的列表列表(您可以在插图开头看到一个示例)。该包会为您计算图中所有区域,然后您可以查询属于每个区域的元素。