How to create (vertically) faceted plots in ggplot2 with dynamic heights such that all facets have the same scale?
When creating faceted plots, all the facets have the same dimensions. Any way to make plots with differing dimensions? In particular, any way to make sure开发者_Go百科 vertically stacked facets all have the same y-scale?
I'm trying the following:
qplot(score, ..count.., data=df, geom='density', position='stack') +
facet_grid(method~., scales='free', space='free')
but I get:
Error in if (length(range) == 1 || diff(range) == 0) { :
missing value where TRUE/FALSE needed
This incantation ended up working for me:
qplot(score, ..count.., data=df, geom='density', fill=I('black')) + opts(strip.text.y = theme_text()) + scale_y_continuous(breaks=seq(0,999,by=50)) + facet_grid(method~., scale='free', space='free'))
精彩评论