powered by
## S3 method for class 'density': tidy(x, ...)
d <- density(faithful$eruptions, bw = "sj") head(tidy(d))
library(ggplot2) ggplot(tidy(d), aes(x, y)) + geom_line()
density