最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

facet - Changing text direction in facet_nested panel - Stack Overflow

programmeradmin4浏览0评论

I am trying to change the text direction in a facet nested chart with three variables on the one panel, I have tried (with only 2 variables) strip.text.y.right and strip.text.y.left, no dice! Ideally I would like the facet panel text to be as follows: left 90 degrees, the mid and right 0 degrees.

df <- data.frame(x = rep(1:10, each = 3),
  y = rnorm(30),population = factor(rep(c(1,2,3,4,5,6),each = 5)),
  group = factor(rep(c("New South Wales", "Queensland", "Victoria"), 10)),
  category1 = factor(rep(c("LRPB Lancer", "LRPB Raider", "LRPB Flanker" ), each = 10))
)
p <- ggplot(df, aes(x, y)) +
  geom_bar(stat = "identity") +
  facet_nested(group+ category1 + population  ~ ., scales = "free", space = "free", switch = "y") +
  theme(
    strip.placement = "outside",
    strip.text.y.left = element_text(angle = 90),  # Rotation for group
    strip.text.y.right = element_text(angle = 0),  # Rotation for category1
    )
p  
发布评论

评论列表(0)

  1. 暂无评论