I have this data frame:
Date Server FileSystem PercentUsed
1 12/1/2011 A / 60
2 1/2/2012 A /var 50
3
Instead of using facets, we could make a list of plots per group, then use cowplot::plot_grid for plotting. Each will have it's own legend:
# make list of plots
ggList <- lapply(split(x, x$Server), function(i) {
ggplot(i, aes(Date, PercentUsed, group = 1, colour = FileSystem)) +
geom_jitter(size = 2) +
geom_smooth(method = "loess", se = TRUE)})
# plot as grid in 1 columns
cowplot::plot_grid(plotlist = ggList, ncol = 1,
align = 'v', labels = levels(x$Server))
As suggested by @Axeman, we could add labels using facet_grid(~Server), instead of labels = levels(x$Server).