Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用brewer.pal时出错(9,“Y10rRd”)_R_Ggplot2_Colors_Colorbrewer - Fatal编程技术网

使用brewer.pal时出错(9,“Y10rRd”)

使用brewer.pal时出错(9,“Y10rRd”),r,ggplot2,colors,colorbrewer,R,Ggplot2,Colors,Colorbrewer,我在ggplot2中的调色板有一些问题。当我尝试下面的代码时,会产生一个错误 library(ggplot2) > ggplot(Vocab, x = education, y = vocabulary, col = year, group = factor(year)) + + stat_quantile(method = "lm", se = F, alpha = 0.6, size = 2) + + scale_color_brewer(colors = brewer

我在
ggplot2
中的调色板有一些问题。当我尝试下面的代码时,会产生一个错误

library(ggplot2)
> ggplot(Vocab, x = education, y = vocabulary, col = year, group = factor(year)) +
+     stat_quantile(method = "lm", se = F, alpha = 0.6, size = 2) +
+     scale_color_brewer(colors = brewer.pal(9, "Y10rRd"))
Warning: Ignoring unknown parameters: se
Error in brewer.pal(9, "Y10rRd") : 
  Y10rRd is not a valid palette name for brewer.pal

“Y10rRd”调色板现在已被删除,或者我是否需要任何先决条件设置才能使其适用于此代码?帮我把它弄好。

我怀疑你打错了“YIORD”。在任何情况下,你都可以在这里找到所有朋友的名字:

嗯,你打错了。调色板名称是
YlOrRd
而不是
yOrrd
见下面的最小可复制示例

library(RColorBrewer)
library(ggplot2)

#  the display.brewer.all function will plot all of them along with their name.
display.brewer.all() 

plot(dist ~ speed, data=cars, pch=19, col=2)
ggplot(iris, aes(x=Sepal.Length, y=Petal.Length, color=Species)) + geom_point()+
  scale_color_brewer(palette = "YlOrRd")

Y10rRd
还是
YlOrRd
?您的打字错误。应该是
YlOrRd
。谢谢。。是的,那是个打字错误。