lemon
lemon copied to clipboard
How to drop unused categories in x axis?
library(ggplot2) library(lemon) df <- data.frame( v1 = c("A", "A", "A", "B", "B", "B"), v2 = c("S1", "S2", "S3", "S7", "S8", "S9"), nm = c(2, 3, 4, 5, 6, 7) )
ggplot(df, aes(x = v2, y = nm)) + geom_point(size = 3) + facet_rep_grid(v1~., scales = "free_x", repeat.tick.labels = T)