[R] shaded area with polygon

L... L... m@r@l@m@ck @ending from hotm@il@com
Mon Jun 11 21:35:15 CEST 2018


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]]



More information about the R-help mailing list