Bob Muenchen
unread,Jan 7, 2012, 11:46:42 AM1/7/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ded...@googlegroups.com
I just came across the row vs. column reversal. When I was trying to reproduce Fig. 3.6 in Hadley's ggplot2 book, I filled in year as the column variable and the plot appeared with year in the rows instead. This was the code Plot Builder wrote:
ggplot() +
geom_point(aes(x = displ,y = hwy),data=mpg,alpha = 0.5952) +
geom_smooth(aes(x = displ,y = hwy),data=mpg,method = 'loess',formula = 'y ~ x') +
facet_grid(facets = year ~ .)
Flipping year into the column position worked fine:
ggplot() +
geom_point(aes(x = displ,y = hwy),data=mpg,alpha = 0.5952) +
geom_smooth(aes(x = displ,y = hwy),data=mpg,method = 'loess',formula = 'y ~ x') +
facet_grid(facets = . ~ year)