Here's one way to do what I think you want:
test<- rnorm(5000,1000,100) test1 <- subset(test, subset=(test > 1100)) d <- density(test) plot(d, main="Density of production", xlab="") lines(d$x[d$x > 1100], d$y[d$x > 1100], col="blue", lwd=2) curveheight <- d$y[abs((d$x - mean(test1))) == min(abs((d$x - mean(test1))))] segments(x0=mean(test1), y0=0, y1=curveheight) Sarah On Mon, Dec 13, 2010 at 1:44 PM, Val <valkr...@gmail.com> wrote: > Hi All, > > I generated 5000 samples using the following script > > test<- rnorm(5000,1000,100) > test1 <- subset(test, subset=(test > 1100)) > d <- density(test) > plot(d, main="Density of production") > abline(v=mean(test1) > > I wanted to do the following but faced difficulties > 1. to shade or color (blue) the curve using the criterion that any values > greater than 11,000 > 2. I drew a vertical line but I wanted the v-line within the curve not to > stick outside the curve > 3. to suppress the output produced at the bottom of the curve( N=5000 and > bandwidth =16.22) > > Thanks in advance > Val > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.