开发者

ggplot2 facet_grid() change background-color

开发者 https://www.devze.com 2023-02-13 16:12 出处:网络
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 th

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 m开发者_Go百科ore understandable with the image below.

Best regards!

ggplot2 facet_grid() change background-color


Untested, try to change the outline:

+ opts(strip.background = theme_rect(colour = 'purple'))

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:

+ opts(strip.background = theme_rect(fill = 'purple'))

Maybe that has been changed by Hadley?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号