Error: Argument 20 matches multiple formal arguments in venn.diagram function
Error: Argument 20 matches multiple formal arguments in venn.diagram function
我是 venn.diagram()
函数的新手,正在尝试创建一个简单的维恩图。这是我使用的数据:
structure(list(Transmitter = c("1657", "1657", "1658", "1659",
"1659", "1660", "1660", "1661", "1662", "1663", "1663", "1664",
"1664", "1666", "1667", "1667", "1668", "1668", "1669", "1670",
"1671", "1671", "1672", "1672", "1673", "1673", "1674", "1674",
"1675", "1675", "1676", "1676", "1678", "1679", "1679", "1680",
"1681", "1681", "1682", "1682", "1683", "1684", "1685", "1686",
"1686", "9782", "9782", "24166", "24166", "24167", "24168", "24169",
"24170", "24171", "24172", "24173", "24174", "24175", "24175",
"24176", "24177", "24178", "24179", "24179", "24180", "24181",
"24182", "24183", "24184", "24184", "24185", "24186", "24187",
"24188", "24189", "24190", "24191", "24192", "24193", "24194",
"24194", "24195", "24195", "24196", "24197", "24198", "24198",
"24199", "24199", "24200", "24201", "24203", "24204", "24204",
"24206", "24207", "24209", "24210", "24211", "24212", "24212",
"24213", "24214", "24215", "24216", "24216", "24217", "24218",
"24219", "30759", "30760", "30761", "30761", "30761", "30762",
"30763", "30764", "30765", "30765", "30765", "30766", "30766",
"30766", "30767", "30767", "30768", "30768", "30768", "30769",
"30769", "30769", "30770", "30771", "30772", "30772", "30772",
"30773", "30773", "30773", "30774", "30774", "30775", "30775",
"30776", "30776", "30777", "30777", "30777", "30778", "30778",
"30779", "30780", "30780", "30780", "30781", "30782", "30782",
"30783", "30784", "30785", "30786", "30787", "30788", "30788"
), Direction = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L), .Label = c("Marine",
"River"), class = "factor")), row.names = c(NA, -164L), class = "data.frame")
我想创建一个每个方向都有一个圆的维恩图。每个圆圈内都有一个数字,表示被视为 'river'、'marine' 或两者的发射机数量。
这是我从网站修改的一些代码:
install.packages('VennDiagram')
library(VennDiagram)
venn.diagram(
x = list(
lasts2WOFD %>% filter(Direction == 'Marine') %>% select(Transmitter) %>% unlist() ,
lasts2WOFD %>% filter(Direction == 'River') %>% select(Transmitter) %>% unlist()
),
category.names = c("Marine" , "Fresh"),
filename = 'VennDiagram',
output = TRUE ,
imagetype="png" ,
height = 480 ,
width = 480 ,
resolution = 300,
compression = "lzw",
lwd = 1,
col=c("#440154ff", '#21908dff'),
fill = c(alpha("#440154ff",0.3), alpha('#21908dff',0.3)),
cex = 0.5,
fontfamily = "sans",
cat.cex = 0.3,
cat.default.pos = "outer",
cat.pos = c(-27, 27),
cat.dist = c(0.055, 0.055),
cat.fontfamily = "sans",
cat.col = c("#440154ff", '#21908dff'),
rotation = 1
)
当 运行 时,我得到这个错误:
Error in VennDiagram::draw.pairwise.venn(area1 = length(x[[1]]), area2 = length(x[[2]]), :
argument 20 matches multiple formal arguments
我知道这并没有回答你的问题,但我只是想让你知道你可以得到其他包的图表。我的 nVennR
包可以通过几个步骤完成。如果你的对象叫做 lasts2WOFD
,
>library(nVennR)
>myV <- plotVenn(list(River=subset(lasts2WOFD, Direction == "River")$Transmitter, Marine=subset(lasts2WOFD, Direction == "Marine")$Transmitter))
结果将是:
您可以按照 vignette 中的说明控制输出。您还可以导出矢量 svg
文件,您可以在之后进行编辑。
关于你的问题,我查看了 VennDiagram
的源代码,发现 rotation
是 venn.diagram
的一部分,而不是 draw.pairwise.venn
的一部分。参数已通过但无法使用。只需删除 rotation=1
即可。
我是 venn.diagram()
函数的新手,正在尝试创建一个简单的维恩图。这是我使用的数据:
structure(list(Transmitter = c("1657", "1657", "1658", "1659",
"1659", "1660", "1660", "1661", "1662", "1663", "1663", "1664",
"1664", "1666", "1667", "1667", "1668", "1668", "1669", "1670",
"1671", "1671", "1672", "1672", "1673", "1673", "1674", "1674",
"1675", "1675", "1676", "1676", "1678", "1679", "1679", "1680",
"1681", "1681", "1682", "1682", "1683", "1684", "1685", "1686",
"1686", "9782", "9782", "24166", "24166", "24167", "24168", "24169",
"24170", "24171", "24172", "24173", "24174", "24175", "24175",
"24176", "24177", "24178", "24179", "24179", "24180", "24181",
"24182", "24183", "24184", "24184", "24185", "24186", "24187",
"24188", "24189", "24190", "24191", "24192", "24193", "24194",
"24194", "24195", "24195", "24196", "24197", "24198", "24198",
"24199", "24199", "24200", "24201", "24203", "24204", "24204",
"24206", "24207", "24209", "24210", "24211", "24212", "24212",
"24213", "24214", "24215", "24216", "24216", "24217", "24218",
"24219", "30759", "30760", "30761", "30761", "30761", "30762",
"30763", "30764", "30765", "30765", "30765", "30766", "30766",
"30766", "30767", "30767", "30768", "30768", "30768", "30769",
"30769", "30769", "30770", "30771", "30772", "30772", "30772",
"30773", "30773", "30773", "30774", "30774", "30775", "30775",
"30776", "30776", "30777", "30777", "30777", "30778", "30778",
"30779", "30780", "30780", "30780", "30781", "30782", "30782",
"30783", "30784", "30785", "30786", "30787", "30788", "30788"
), Direction = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
1L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L), .Label = c("Marine",
"River"), class = "factor")), row.names = c(NA, -164L), class = "data.frame")
我想创建一个每个方向都有一个圆的维恩图。每个圆圈内都有一个数字,表示被视为 'river'、'marine' 或两者的发射机数量。
这是我从网站修改的一些代码:
install.packages('VennDiagram')
library(VennDiagram)
venn.diagram(
x = list(
lasts2WOFD %>% filter(Direction == 'Marine') %>% select(Transmitter) %>% unlist() ,
lasts2WOFD %>% filter(Direction == 'River') %>% select(Transmitter) %>% unlist()
),
category.names = c("Marine" , "Fresh"),
filename = 'VennDiagram',
output = TRUE ,
imagetype="png" ,
height = 480 ,
width = 480 ,
resolution = 300,
compression = "lzw",
lwd = 1,
col=c("#440154ff", '#21908dff'),
fill = c(alpha("#440154ff",0.3), alpha('#21908dff',0.3)),
cex = 0.5,
fontfamily = "sans",
cat.cex = 0.3,
cat.default.pos = "outer",
cat.pos = c(-27, 27),
cat.dist = c(0.055, 0.055),
cat.fontfamily = "sans",
cat.col = c("#440154ff", '#21908dff'),
rotation = 1
)
当 运行 时,我得到这个错误:
Error in VennDiagram::draw.pairwise.venn(area1 = length(x[[1]]), area2 = length(x[[2]]), :
argument 20 matches multiple formal arguments
我知道这并没有回答你的问题,但我只是想让你知道你可以得到其他包的图表。我的 nVennR
包可以通过几个步骤完成。如果你的对象叫做 lasts2WOFD
,
>library(nVennR)
>myV <- plotVenn(list(River=subset(lasts2WOFD, Direction == "River")$Transmitter, Marine=subset(lasts2WOFD, Direction == "Marine")$Transmitter))
结果将是:
您可以按照 vignette 中的说明控制输出。您还可以导出矢量 svg
文件,您可以在之后进行编辑。
关于你的问题,我查看了 VennDiagram
的源代码,发现 rotation
是 venn.diagram
的一部分,而不是 draw.pairwise.venn
的一部分。参数已通过但无法使用。只需删除 rotation=1
即可。