geom_ribbon 中的渐变
我有以下 ggplot2 代码,用于绘制从第三个四分位数到第 97 个四分位数的功能区:
h <- ggplot(l, aes(x=age[limit]))
h <- h + geom_ribbon(aes(ymin=X3rd[limit], ymax=X97th[limit]), fill="gray80")
h
geom_ribbon 帮助页面建议梯度、梯度2等是用于填充该几何图形的“相关比例”。我想要的是让丝带在外面呈浅灰色,在中间变成深灰色,然后在外面再次变成浅灰色,但我得到的印象是渐变不能(并且一些谷歌结果强化了这种印象)实际上应用于丝带。
I have the following ggplot2
code that plots the ribbon from the 3rd to the 97th quartile:
h <- ggplot(l, aes(x=age[limit]))
h <- h + geom_ribbon(aes(ymin=X3rd[limit], ymax=X97th[limit]), fill="gray80")
h
The geom_ribbon help page suggests that gradient, gradient2, etc are 'related scales' for fill for this geom. What I'm after is to have the ribbon light grey on the outside, to darker grey in the middle then lighter grey again on the outside, but I get the impression (and some google results strengthen this impression) that the gradients can't actually be applied to ribbon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
geom_ribbon 不支持渐变。
相反,如果我正确理解你想要做什么,那么重叠的丝带可能会很有用:
geom_ribbon does not support gradient.
Instead, if I correctly understand what you want to do, then overlapping ribbons may be useful: