gpt4 book ai didi

r - 更改构面标签文本和背景颜色

转载 作者:行者123 更新时间:2023-12-03 09:08:17 25 4
gpt4 key购买 nike

如何将灰色刻面标签(A 和 B)更改为带有白色文本的红色背景?

library(data.table)
A = data.table(x = 1:4, y = 1:4, z = c('A','A','B','B'))
ggplot(A) + geom_point(aes(x = x, y = y)) + facet_wrap(~z) + theme_bw()
enter image description here

最佳答案

你可以做:

ggplot(A) +
geom_point(aes(x = x, y = y)) +
facet_wrap(~z) +
theme_bw()+
theme(strip.background =element_rect(fill="red"))+
theme(strip.text = element_text(colour = 'white'))

enter image description here

关于r - 更改构面标签文本和背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41631806/

25 4 0