通过panel参数给散点图添加回归线、光滑曲线、轴须、网格线等
h=-1 and v=-1are intended to make the grids aligned with the axis labels. 使网格与轴标签对齐
mypanel function(x,y){
panel.xyplot(x,y,pch = 19)#添加散点图panel.rug(x,y) #添加坐标轴须panel.grid(h =-1,v =-1) #添加水平和竖直网格线,使用负数强制与轴标签对齐panel.lmline(x,y,col = “red”, lwd = 1,lty = 2)} #添加一条回归线
xyplot(mpg ~wt|disp, data = mtcars,layout = c(3,1),aspect = 1.5,panel = mypanel,main = “Miles per Gallon vs Weight by Engin Displacesment”,xlab = “Weight”,ylab = “Miles per Gallon”)
Aspect:
此参数控制面板的物理纵横比,通常所有面板的物理纵横比都相同。它可以指定为比率(垂直大小/水平大小)或字符串。
Aspect此参数的控制面板的物理纵横对比,通常所有面板的物理纵横比都相同,它可以指定为比率(垂直大小/水平大小)或者字符串
通过添加条件变量,可以创建出各个水平下的面板。若想要把不同水平的图形结