Q:

What does the y axis in a kernel density plot mean?

Possible Duplicate:
Probability distribution value exceeding 1 is OK? 

I thought the area under the curve of a density function represents the probability of getting an x value between a range of x values, but then how can the y-axis be greater than 1 when I make the bandwidth small? See this R plot:
range <- seq(2,6,.01)
n <- 1000
d <- sample(range,n, replace=TRUE)
d <- c(d,rep(0,100))
d <- c(d,rep(1,50))
df <- data.frame(counts=d)
adjust <- 1/20
dens <- density(d,adjust=adjust)
plot(dens)

Also, the probability of getting $P(x<2)=\frac{150}{1000}=.15$, how can I see this in the plot?

A:

You are correct that

the area under the curve of a density function represents the probability of getting an x value between a range of x values

But remember area is not just height: width is also important. So if you have a spike at 0, if the width is very small (say 0.1) then the height can be quite a bit higher than 1 (up to 10, if the spike is perfectly rectangular, since $0.1\times10 = 1$) without violating any rules of probability. The height of the spike is large, but the area under the spike is still quite small.
For the same reason, density functions of continuous random variables can have values greater than one. If you plot a Normal(0,0.0001) pdf, for example, you will find that the peak is quite high.
I missed your second question initially, but $P(x<2)=\frac{150}{1000}=.15$ means that the area under the curve to the left of 2 (i.e., the area of the two spikes at 0 and 1, more or less) is .15.

