Switch placement of facet_grid labels

泪湿孤枕 提交于 2019-12-10 11:18:47

问题


How can I change the placement of the labels of facet_grid() without switching the formula?

library(plyr)
library(ggplot2)

data = data.frame(id = 1:10, value = rnorm(100*10))
data = ddply(data, .(id), transform, obs = 1:100)

ggplot(data = data, aes(x = obs, y = value, color = factor(id))) + 
  geom_line() +
  facet_grid(id ~.)

In the following picture, I want the panel text to switch from the right to the top of the panel.


回答1:


ggplot(data = data, aes(x = obs, y = value, color = factor(id))) + 
         geom_line() +
         facet_wrap( ~id, ncol=1)



来源:https://stackoverflow.com/questions/22127120/switch-placement-of-facet-grid-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!