Just for the shake of completing the answer given by eipi10.
I was facing the same problem, without using scale_y_continuous
nor coord_cartesian
.
The conflict was coming from the x axis, where I defined limits = c(1, 30)
. It seems such limits do not provide enough space if you want to "dodge" your bars, so R still throws the error
Removed 8 rows containing missing values (geom_bar)
Adjusting the limits of the x axis to limits = c(0, 31)
solved the problem.
In conclusion, even if you are not putting limits to your y axis, check out your x axis' behavior to ensure you have enough space