【发布时间】:2020-09-25 06:06:24
【问题描述】:
我想在 R 中使用 lattice::xyplot() 在由第三个因素变量确定的面板中绘制两个定量变量。我想要透明黑色符号,带有实心红色趋势线。为了提供一个工作示例,我将使用 R 中的 iris 数据集。以下四种尝试都没有达到预期的结果(其中一个是由Add alpha value to lattice xyplot panel function 的线程通知的):
library(datasets)
data(iris)
xyplot(Sepal.Length ~ Sepal.Width | Species, data = iris,
type = c("p","smooth"), alpha=.1, pch=19, col="black", col.line="red", lwd=2)
xyplot(Sepal.Length ~ Sepal.Width | Species, data = iris,
type = c("p","smooth"),
par.settings = list(superpose.symbol = list(cex=1, pch=20, col="black", alpha = 0.1),
superpose.line = list(col = "red", lwd = 2)))
xyplot(Sepal.Length ~ Sepal.Width | Species, data = iris,
grid = TRUE, scales=list(tck=c(1,0), x=list(cex=1.1), y=list(cex=1.1)),
par.settings = list(superpose.symbol = list(pch =20, cex = 1, col = c("#0808084d"))),
type = c("p", "smooth"), col.line =c("red"),lwd = 2)
xyplot(Sepal.Length ~ Sepal.Width | Species, data = iris,
par.strip.text=list(cex=0.6),
type = c("p","smooth"),
par.settings = list(superpose.symbol = list(cex=1, pch=20, col="black", alpha = 0.1),
superpose.line = list(col = "red", lwd = 2)))
非常感谢任何指导。
【问题讨论】: