I'm curious why the vertical line is showing at -10 and not 10 in the following example:
x <- rnorm(1e4, 0, 10)
plot(density(x))
abline(10, 1, col = "red")
CodePudding user response:
What you need is using h=10
instead of a=10, b=1
. From the helpfile you can read:
h
the x-value(s) for vertical line(s).
So, to produce your desired output use the following:
abline(v=10, col = "red")