Here is an example using explicit breaks. Note ggplot2 extends the range a bit, so you need to make the max conditional a bit larger than you may expect
library(ggplot2)
diamonds2 <- subset(diamonds, !(cut == "Fair" & price > 5000))
my_breaks <- function(x) { if (max(x) < 6000) seq(0, 5000, 1000) else seq(0, 15000, 5000) }
ggplot(data = diamonds2, aes(x = carat, y = price)) +
facet_wrap(~ cut, scales = "free_y") +
geom_point() +
scale_y_continuous(breaks = my_breaks)
Created on 2018-07-02 by the reprex package (v0.2.0).
