I can generate 2 big facets with facet_grid based on the factor (a). I can generate one facet for each id + factor combination with facet_wrap or facet_grid (b). I would like to have 3 facets: a(D+E) b(D+E) c(D+E) (c).
testd <- data.frame(id=c("a","b","c"),value=1:12,fac=c("D","E"))
#(a)
ggplot(testd, aes(x=id,y=value))+ geom_point() + facet_grid(. ~ fac)
#(b)
ggplot(testd, aes(x=id,y=value))+ geom_point() + facet_wrap(id ~ fac, nrow=1, scales="free_x")
ggplot(testd, aes(x=id,y=value))+ geom_point() + facet_grid(. ~ id + fac, scales="free_x")
### schema:
(a)
--D-- --E--
a b c a b c
(b)
aD aE bD bE cD cE
(c)
DE DE DE
a b c
What I would like to have is for each id one facet with points split into D and E in the same facet.
I suppose you're looking for this:
I replaced
x = id
insideaes
withx = fac
.