Closed corriebar closed 5 years ago
I think this is a general issue with using ylim()
to limit axes / to zoom in, not an issue with lineribbon: ylim()
removes data outside of its bounds instead of drawing the plot and clipping it, which leads to weird behavior for most geoms.
If you replace ylim(0, 8)
with coord_cartesian(ylim = c(0, 8))
do you get the expected behavior?
See also this stackoverflow post: https://stackoverflow.com/questions/25685185/limit-ggplot2-axes-without-removing-data-outside-limits-zoom
Yes, you're right, coord_cartesian(ylim=c(0,8))
works as expected.
Great!
stat_lineribbon
introduces non-linear artifacts (for linear models) when zooming in on certain parts of the plot:For
geom_lineribbon
some of the outer ribbons are lost in the plot, which makes it more obvious that the plot is faulty: