The general solution that I would like is to be able to specify arbitrary axis limits for each facet independently.
Basic functionality is obtained by setting the sc
Before this is closed, I think it is important to expand the suggestion by @Axeman : this may not be possible with facet_wrap
directly, but the behavior can be achieved by chunking the groups you want and stitching them together with cowplot
. Here, I separated into "low" and "high" quality, but the grouping is arbitrary and could be whatever you wanted. Likely want to mess with the style a bit, but the default from cowplot
is acceptable for this purpose:
library(cowplot)
lowQ <-
ggplot(diamonds %>%
filter(as.numeric(clarity) <= 4)
, aes(x = carat
, y = price)) +
geom_point() +
facet_wrap(~clarity
, nrow = 1)
hiQ <-
ggplot(diamonds %>%
filter(as.numeric(clarity) > 4)
, aes(x = carat
, y = price)) +
geom_point() +
facet_wrap(~clarity
, nrow = 1)
plot_grid(lowQ, hiQ, nrow = 2)