Search code examples
rplotkernel-densitydensity-plot

Suppressing the default grey horizontal line in density() in R


I was wondering if there is an argument to suppress the default grey horizontal abline (see picture below) that comes with density() in R?

plot(density(rnorm(1e4)))

enter image description here


Solution

  • Sure is, as ?plot.density tells us:

    plot(density(rnorm(10000)), zero.line = FALSE)