ggplot2 facet_grid() 更改背景颜色
我使用 facet_grid()
创建了一个如下图所示的图表,对不同的图表进行分组。现在我想让图表更漂亮,并想改变右侧的背景颜色。但我发现的唯一的东西是 opts(strip.text.y = theme_text(hjust = 0)) 可以改变文本的颜色。
那么,可以改变右侧部分的背景颜色吗?我尝试用下图让它更容易理解。
此致!
I created a graph like in the image below using facet_grid()
to group the different graphs. Now I want to make the graph prettier and want to change the background color of right side. But the only thing I found was opts(strip.text.y = theme_text(hjust = 0))
that can change the color of the text.
So, it is possible to change the background color of the right part? I tried to make it more understandable with the image below.
Best regards!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
未经测试,尝试更改轮廓:
在 qplot / ggplot2 代码末尾。如果您不知道:此链接到 github 上的 Hadley 参考资料(而非文档)可能会有所帮助。
编辑:
感谢乔纳森,我实现了以下作品,上面的代码片段只是改变了轮廓。这个是为了填充:
也许哈德利已经改变了这一点?
Untested, try to change the outline:
at the end of your qplot / ggplot2 code. And in case you did not know: this Link to Hadley's reference on github (not documentation) might help.
EDIT:
thanks to Jonathan, I realized the following works, the upper snippet just changes the outline. This one is for the fill:
Maybe that has been changed by Hadley?