更改geom_smooth的标准错误颜色 [英] Change standard error color for geom_smooth

查看:294
本文介绍了更改geom_smooth的标准错误颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用geom_smooth绘制一些数据,并寻找一种方法来更改每条线的标准错误阴影的颜色以匹配该行(即,一条红线将其标准错误阴影涂成红色).

I'm plotting some data using geom_smooth and looking for a way to change the color of the standard error shading for each line to match that line (ie., a red line would have it's standard error shaded red).

我在 https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List .

任何建议(或只是确认是否可行)都是值得的.

Any advice (or just confirmation of whether or not it's possible) is appreciated.

推荐答案

您的(可理解的)错误是认为您应该更改颜色而不是 fill .标准错误阴影基本上是用geom_ribbon制成的,它们是2d区域,因此填充"它们的颜色"由fill而不是colour确定.

Your (understandable) mistake is to think that you should be changing the color rather than the fill. The standard error shadings are made with geom_ribbon essentially, and they are a 2d area, so the "color" they are "filled" with is determined by fill, not colour.

尝试:

geom_smooth(aes(...,fill = variable))

其中变量与您要映射到其他位置的颜色相同.

where variable is the same one you map to colour elsewhere.

这篇关于更改geom_smooth的标准错误颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆