2017-03-02 20 views
0

背景:技術得到細緻的多邊形中的R

我有一個polygon(),因爲我需要它(看到我的R代碼裏面吹)看起來不專業。

我通常使用兩種通用技術使ploygon()以我想要的方式出現。 首先,在我的曲線,我用lwd = larger than 1第二個,在我的多邊形,我刪除我的polygon()的邊界由border = NA

在這種情況下,由於某些原因,我不能使用第一種技術。

問:

我不知道還有什麼我可以做除了給去除border=NApolygon()來提高我的多邊形?

curve(dnorm(x), -3, 3, bty="n", ann=F, axes=F, col="blue") 

xs <- seq(-0.5, 0.5, len=1000) 
polygon(c(xs[1], xs, xs[1000]), c(0, dnorm(xs), 0), col='grey', border = NA) 

回答

0

我不知道有多好,這是,但也許polygon

curve(dnorm(x), -3, 3, bty="n", ann=F, axes=F, col=NA) 
xs <- seq(-0.5, 0.5, len=1000) 
polygon(c(xs[1], xs, xs[1000]), c(0, dnorm(xs), 0), col='grey', border = NA) 
curve(dnorm(x), -3, 3, col='blue', add = TRUE, n = 1e4) 
#n = 1e4 helps plot curve with more points (default in 101), making it smoother 
+0

'add'不與'plot'允許之後添加curve。您可以從'plot'開始,但在後續步驟中使用'polygon'和'curve'(用'add = TRUE'作曲線) –

+0

Dear db,do think [** THIS QUESTION **](http:// stackoverflow .com/questions/43315279/solve-for-shape1-and-shape2-in-qbeta-in-r)會對你感興趣嗎? – rnorouzian