【问题标题】:Shading a region under a PDF [duplicate]对 PDF 下的区域进行着色[重复]
【发布时间】:2017-11-15 13:03:33
【问题描述】:

我使用以下方法绘制了 Weibull 分布 W(2,3):

Weibull=function(x){
(2*x/9)*exp(-(x^2)/9)
}
xx=seq(from=0,to=10,length.out=1000)
xx1=Weibull(xx)
plot(xx,xx1,type="l")
polygon(xx, xx1, col = "red", border = NA)

PDF plot

我只想对 (4,10) 之间的区域进行着色。我该怎么做呢?

【问题讨论】:

    标签: r plot


    【解决方案1】:
    xx2=seq(from=4,to=10,length.out=1000)
    yy2=c(Weibull(xx2),0)
    xx2=c(xx2,4)
    plot(xx,xx1,type="l")
    polygon(xx2, yy2, col = "red", border = NA)
    

    【讨论】:

      猜你喜欢
      • 2021-08-02
      • 2012-09-07
      • 2012-04-20
      • 1970-01-01
      • 1970-01-01
      • 2021-12-03
      • 1970-01-01
      • 2021-04-08
      相关资源
      最近更新 更多