R 如何控制晶格xyplot中的椭圆颜色?

R 如何控制晶格xyplot中的椭圆颜色?,r,plot,lattice,R,Plot,Lattice,我想在晶格xyplot中更改椭圆颜色和宽度。 以下是一个例子: library(lattice) xyplot(Sepal.Length ~ Petal.Length, groups=Species, data = iris, scales = "free", par.settings = list(superpose.symbol = list(pch = 18, cex = 0.9,col = c("green", "orange","brown"),superp

我想在
晶格xyplot
中更改
椭圆颜色
宽度
。 以下是一个例子:

library(lattice)
xyplot(Sepal.Length ~ Petal.Length, groups=Species,
       data = iris, scales = "free",
       par.settings = list(superpose.symbol = list(pch = 18, cex = 0.9,col = c("green", "orange","brown"),superpose.line = list(lwd=2))),
       panel = function(x, y, ...) {
           panel.xyplot(x, y, ...)
           panel.ellipse(x, y, ...)
       },
       auto.key = list(x = .1, y = .8, corner = c(0, 0)))
我想匹配椭圆颜色的点,并增加其宽度。

用户20650的评论中所述,您可以向
面板.eliple
功能添加其他选项。在这种情况下,您需要添加
col
lwd
选项

library(lattice)
library(latticeExtra) # you forgot to mention this package in question

xyplot(Sepal.Length ~ Petal.Length, groups = Species, data = iris,
       scales = "free", auto.key = list(x = 0.1, y = 0.8, corner = c(0, 0)),
       par.settings = list(superpose.symbol = list(pch = 18, cex = 0.9,
                           col = c("green", "orange","brown"),
                           superpose.line = list(lwd=2))),
       panel = function(x, y, ...) {
           panel.xyplot(x, y, ...)
           panel.ellipse(x, y, col = c("green", "orange", "brown"), 
                         lwd = c(5, 5, 5), ...)
       }
)

面板。椭圆(x,y,col=c(“绿色”、“橙色”、“棕色”),lwd=3,…)