[R] curve

Sarah Goslee sarah.goslee at gmail.com
Mon Dec 13 20:56:33 CET 2010


On Mon, Dec 13, 2010 at 2:12 PM, Ashta <sewashm at gmail.com> wrote:
> 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,

Here's an example of how to do that using polygon:
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=7

> 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

I checked it before I sent it to you. The code I provided works correctly
on my computer.  (R 2.12.0, Linux).

You could try this statement instead:
segments(x0 = mean(test1), y0 = 0, x1=mean(test1), y1 = curveheight)

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list