[英]Adding both panel.lmline and panel.smoothScatter to a lattice xyplot
我正在嘗試將線性趨勢線添加到已由panel.smoothScatter
平滑的散點圖中。
根據其他帖子,我嘗試添加type=c("p","r")
但這沒有任何作用。 我也試過讓面板成為一個調用兩者的函數,但這會導致一個空白的情節:
#plots smoothed scatter without trend line
p2 <- xyplot(y~x, grid=T, type=c("p","r"), panel=panel.smoothScatter)
#plots nothing
p2 <- xyplot(y~x, grid=T, type=c("p","r"), panel=function(...){panel.smoothScatter;panel.lmline})
如何在一個xyplot中使用多個panels
?
您只需修復自定義面板功能即可正確調用所需的面板功能
p2 <- xyplot(y~x, grid=T, panel=function(...){
panel.smoothScatter(...)
panel.lmline(...)
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.