Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试绘制两个变量:Eeff vs Neff 使用 lattice 包的 xyplot 函数。我想知道如何在这个散点图中添加一条线(这是普通 R 图形系统中的 abline 函数)。
xyplot(Neff ~ Eeff, data = phuong, xlab = "Energy efficiency (%)", ylab = "Nitrogen efficiency (%)")
该lattice软件包有几个“面板功能”,其中之一是panel.abline.
lattice
panel.abline
试试这个,看看它是否能给你你想要的东西:
xyplot(Neff ~ Eeff, data = phuong, panel = function(x, y) { panel.xyplot(x, y) panel.abline(lm(y ~ x)) }, xlab = "Energy efficiency (%)", ylab = "Nitrogen efficiency (%)")