Even if your data falls within your specified limits (e.g. c(0, 335)
), adding a geom_jitter()
statement could push some points outside those limits, producing the same error message.
library(ggplot2)range(mtcars$hp)#> [1] 52 335# No jitter -- no error messageggplot(mtcars, aes(mpg, hp)) + geom_point() + scale_y_continuous(limits=c(0,335))# Jitter is too large -- this generates the error messageggplot(mtcars, aes(mpg, hp)) + geom_point() + geom_jitter(position = position_jitter(w = 0.2, h = 0.2)) + scale_y_continuous(limits=c(0,335))#> Warning: Removed 1 rows containing missing values (geom_point).
Created on 2020-08-24 by the reprex package (v0.3.0)