ggplot position_dodge(preserve ="single")的未使用参数错误 [英] Unused argument error with ggplot position_dodge(preserve = "single")
问题描述
尝试在此处中使用的position_dodge()保留参数时遇到错误ggplot文档中的a>.
I am getting error when trying to use the preserve argument to position_dodge() described here in the ggplot documentation.
ggplot(
mtcars,
aes(
factor(cyl),
fill = factor(vs)
)
) +
geom_bar(position = position_dodge(preserve = "single"))
position_dodge(preserve ="single")中的错误:未使用的参数(preserve ="single")
Error in position_dodge(preserve = "single") : unused argument (preserve = "single")
我正在使用R版本3.4.1和ggplot2版本2.2.1
I am using R version 3.4.1 and ggplot2 version 2.2.1
有什么建议吗?谢谢
推荐答案
在 ggplot2
的开发版本中似乎存在 preserve
自变量在函数 position_dodge2()
中,而不是普通的 position_dodge()
函数中.此链接显示了我如何找到该信息的: https://github.com/tidyverse/ggplot2/search?utf8=%E2%9C%93&q=preserve&type=
It looks like the preserve
argument is present in the development version of ggplot2
but for the moment only in the function position_dodge2()
and not in the normal position_dodge()
function. This link shows how I found that information: https://github.com/tidyverse/ggplot2/search?utf8=%E2%9C%93&q=preserve&type=
我不清楚为什么在线文档( http://ggplot2.tidyverse.org/reference/index.html )显示 preserve
作为当前可用的功能.
It's unclear to me why the online documentation (http://ggplot2.tidyverse.org/reference/index.html) shows preserve
as a current, usable feature.
如果您确实要使用此功能,则可以尝试安装开发版本.我不知道那是否是个好主意!
If you really want to use this function you could try installing the development version. I have no idea if that would be a good idea or not!
install.packages("devtools")
library(devtools)
devtools::install_github("tidyverse/ggplot2")
这篇关于ggplot position_dodge(preserve ="single")的未使用参数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!