问题
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