[R] shaded area with polygon

William Dunlap wdun|@p @end|ng |rom t|bco@com
Mon Jun 11 21:45:30 CEST 2018


Does
  polygon(c(x,rev(x)), c(y, rev(z)), col="orange")
do what you want?

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Jun 11, 2018 at 12:35 PM, L... L... <mar.lamack using hotmail.com> wrote:

> Dear All, I know this is a trivial question .. but .. I want to shade the
> area between 2 curves. For example:
>
> x <- 1:10
>
> y <- 3*x^2 + 2*x + 7
>
> z <- y + 100
>
> plot(x, y,  type = 'l')
>
> lines(x, z)
>
> I can not understand polygon.
>
> I tried
>
> polygon(cbind(c(min(x), x, max(x)), c(min(y), z, max(y))), col="#00CC66")
>
> But I do not return what I want.
>
> Thank you very much
>
> ML
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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]]




More information about the R-help mailing list