ggplot2:“未知参数:probs” for fun.y = geom_line()中的分位数 [英] ggplot2: "Unknown parameters: probs" for fun.y = quantile in geom_line()
问题描述
以下用于绘制10%分位数行的代码会产生一个错误未知参数:probs。有人知道为什么吗?
$ g $ p $ g $ g $ ggplot(aes(y = mpg,x = cyl),data = mtcars)+
geom_point(color =orange)+
geom_line(stat ='summary',fun.y = quantile,probs = 0.1)
我已更新到ggplot的最新版本,并使用以下R版本:
R .Version()
$ platform
[1]x86_64-w64-mingw32
$ arch
[1]x86_64
$ os
[1]mingw32 p>
$ system
[1]x86_64,mingw32
$ status
[1]
$ major
[1]3
$ 1 b
$ 1 b $ b $ 1 b $ b $ 1 b $ b $ 1 b $ b $ 1 b $ b $ 1 b $ b $ 1 b
$ 1 $ / p>
$ month
[1]04
$ day
[1]16
$
svn rev
[1] 68180
$语言
[1]R
$ version.string
[1]R version 3.2.0(2015-04-16)
$昵称
[1]Full of Ingredients
我花了一些时间来研究ggplot2 2.0-helpfiles。对于这种情况,他们此处。在新版本中有一个参数 fun.args
。因此,我可以使用ggplot的更新版本运行此代码并生成所需的图:
ggplot(aes(y = mpg,x = cyl),data = mtcars)+
geom_point(color =orange)+
geom_line(stat ='summary',fun.y =quantile,fun.args = list(probs = 0.1))
The following code for drawing a line of the 10% quantile produces an error "Unknown parameters: probs". Does anybody know why?
ggplot(aes(y = mpg, x = cyl), data = mtcars) +
geom_point(color = "orange") +
geom_line(stat = 'summary', fun.y = quantile, probs = 0.1)
I have updated to the newest version of ggplot and use the following R version:
R.Version()
$platform
[1] "x86_64-w64-mingw32"$arch
[1] "x86_64"$os
[1] "mingw32"$system
[1] "x86_64, mingw32"$status
[1] ""$major
[1] "3"$minor
[1] "2.0"$year
[1] "2015"$month
[1] "04"$day
[1] "16"$
svn rev
[1] "68180"$language
[1] "R"$version.string
[1] "R version 3.2.0 (2015-04-16)"$nickname
[1] "Full of Ingredients"
It took me some digging through the ggplot2 2.0-helpfiles. For this case, they are here. In the new version there is an argument fun.args
. So, I was able to run this code with an updated version of ggplot and produce the desired plot:
ggplot(aes(y = mpg, x = cyl), data = mtcars) +
geom_point(color = "orange") +
geom_line(stat = 'summary', fun.y = "quantile", fun.args=list(probs=0.1))
这篇关于ggplot2:“未知参数:probs” for fun.y = geom_line()中的分位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!