shaded area under curve R

感情迁移 提交于 2020-01-02 10:03:05

问题


I am trying to plot a shaded area under a curve but however the shaded area is over the curve. Can anyone tell me what's wrong with my code?

x=seq(0,30)
y1=exp(-0.1*x)
plot(x,y1,type="l",lwd=2,col="chocolate1")
polygon(x,y1, density = 5, angle = 45,col="chocolate1")

回答1:


you probably want something like this:

polygon(c(min(x),x),c(min(y1),y1), density = 5, angle = 45,col="chocolate1")


来源:https://stackoverflow.com/questions/35987909/shaded-area-under-curve-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!