Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/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
R geom_色带中的梯度_R_Ggplot2_Gradient - Fatal编程技术网

R geom_色带中的梯度

R geom_色带中的梯度,r,ggplot2,gradient,R,Ggplot2,Gradient,我有以下ggplot2代码,用于绘制从第3个四分位数到第97个四分位数的功能区: h <- ggplot(l, aes(x=age[limit])) h <- h + geom_ribbon(aes(ymin=X3rd[limit], ymax=X97th[limit]), fill="gray80") h hgeom_功能区不支持渐变。 相反,如果我正确理解您想要做什么,那么重叠的色带可能会有用: d <- data.frame(x=1:10, m=runif(10))

我有以下
ggplot2
代码,用于绘制从第3个四分位数到第97个四分位数的功能区:

h <- ggplot(l, aes(x=age[limit]))
h <- h + geom_ribbon(aes(ymin=X3rd[limit], ymax=X97th[limit]), fill="gray80") 
h

hgeom_功能区不支持渐变。
相反,如果我正确理解您想要做什么,那么重叠的色带可能会有用:

d <- data.frame(x=1:10, m=runif(10))
d <- transform(d, l1=m-1, l2=m-2, u1=m+1, u2=m+2)

ggplot(d, aes(x)) + 
  geom_ribbon(aes(ymin=l2, ymax=u2), fill="grey60") + 
  geom_ribbon(aes(ymin=l1, ymax=u1), fill="grey40")

d感谢您的回复。这是我在同一时间所做的,仍然看起来相当不错,因为我有第5/9、第10/90和第25/75百分位。我曾读到,你可以尝试使用geom_tile来实现渐变效果,但听起来非常微妙。谢谢你的确认。