When I try to plot the density of some numerical data either using geom_density() or stat_density(), I get a non-smooth curve. Using adjust do not change this.
Here I've used facet_zoom(), but also coord_cartesian(xlim = c(...)) produces this non-smooth curve. Pretty weird in my opinion. Any suggestions what's going on?
https://drive.google.com/file/d/1PjQp7XkY5G21NoIo8y8lyeaXKvuvrqVk/view?usp=sharing
Edit: I have uploaded 50000 rows of the original data. To reproduce the plot (not using ggforce), use the code:
data <- read.table("rep.txt")
(
ggplot(data, aes(x = x))
+ geom_density(adjust = 1, fill = "grey")
+ coord_cartesian(xlim = c(-50000,50000))
+ labs(x = "", y = "")
+ theme_bw()
)