开发者

How to rotate category title with facet_wrap?

开发者 https://www.devze.com 2022-12-07 17:48 出处:网络
look at my code: library(ggplot2) ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(vars(class)) How to rotate the title of each category (2seater, compact etc), to place them on the rig开发

look at my code:

library(ggplot2)

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  facet_wrap(vars(class))

How to rotate category title with facet_wrap?

How to rotate the title of each category (2seater, compact etc), to place them on the rig开发者_如何学编程ht and horizontal?


You could place the strip text on the right via the strip.position argument of facet_wrap and make them horizontal via the theme option strip.text.y:

library(ggplot2)

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  facet_wrap(vars(class), strip.position = "right") +
  theme(strip.text.y = element_text(angle = 0))

How to rotate category title with facet_wrap?

0

精彩评论

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