Thanks Sarah,

> 1. to shade or color (blue) the curve using the criterion that any values
greater than 11,000

I think I was not clear in the above point. I want shade not the line but
the area under the curve,

and
Your last line of code,
segments(x0=mean(test1), y0=0, y1=curveheight)

gave me the  following error message

Error in segments(x0 = mean(test1), y0 = 0, y1 = curveheight) :
 element 3 is empty;
  the part of the args list of '.Internal' being evaluated was:
  (x0, y0, x1, y1, col = col, lty = lty, lwd = lwd, ...)

could you check it please



On Mon, Dec 13, 2010 at 2:01 PM, Sarah Goslee <sarah.gos...@gmail.com>
wrote:
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to