水一篇~
data = mtcars
ggplot(data, aes(mpg, disp)) +
geom_point() + theme_bw() +
facet_grid(cyl ~ gear) + # 按照 cyl和 gear分面
theme(strip.text.x = element_text(size = 30, colour = "#FC0043")) + # 设置分面的字字体大小、颜色、背景、边框,
theme(strip.text.y = element_text(size = 15, colour = "#60FC00")) +
theme(strip.background.x = element_rect(fill = "#00FCE6", colour = "#00FCE6")) +
theme(strip.background.y = element_rect(fill = "#DB00FC", colour = "#DB00FC")) +
theme(strip.placement = "outside") + # 分面条带放外面
theme(strip.switch.pad.grid = unit(1, "inch")) # 设置分面条带与坐标轴的距离
网友评论