如何在r car scatterplotMatrix函数中设置回归线颜色

如何在r car scatterplotMatrix函数中设置回归线颜色,r,plot,colors,R,Plot,Colors,如何更改r car scatterplotMatrix函数中回归线的颜色 如果我运行此代码: # Load the iris dataset. library(car) data(iris) # Plot #1: Basic scatterplot matrix of the four measurements scatterplotMatrix(~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width, data=iris) 然后我得到这个图:

如何更改r car scatterplotMatrix函数中回归线的颜色

如果我运行此代码:

# Load the iris dataset.
library(car)
data(iris)
 
# Plot #1: Basic scatterplot matrix of the four measurements
scatterplotMatrix(~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width, data=iris)
然后我得到这个图:

检查表明,点、平滑窗口和回归线都是相同的颜色,并且没有很清楚地区分


如果我想要蓝色的点,绿色的回归,橙色的平滑,我该怎么做?

这只需要仔细阅读文档
?scatterplotMatrix

关于颜色的部分说:

col
点的颜色;默认设置为从起始点开始的Carpalete 第二种颜色。regLine和smooth的颜色与的相同 点
,但可以使用regLine和smooth参数更改

regLine
的描述是:

regLine=TRUE相当于regLine=list(方法=lm,lty=1,lwd=2,col=col[1])

平滑
更复杂。详细信息部分给出了描述。该描述很长,但包括:

还可以指定要用于平均值和平均值的颜色 方差使用参数col.smooth和col.spread进行平滑

把这些放在一起,你可以

scatterplotMatrix(~Sepal.Length+Sepal.Width+Petal.Length+Petal.Width, 
    data=iris, regLine = list(col="green"),
    smooth=list(col.smooth="orange", col.spread="orange"))

文档并非真正明确无误。谁能告诉我参数
col.smooth
col.spread
不能用在
scatterplotMatrix
中,而不能用在
smooth=list(…)
中。