格键不符合剧情审美
Lattice key does not correspond to aesthetics on plot
你好,下面是使用 lattice 创建的图。我正在使用 lty=c(1, 2) 所以线条是黑色的但是有两种类型。然而,在钥匙中,线条颜色为蓝色和粉红色?我不确定如何纠正这个问题。谢谢!
column1 <- c(89.66, 89.66, 93.10, 96.55, 86.21, 89.66, 86.21, 79.31, 79.31, 79.31, 89.66, 82.76, 100, 93.33, 90, 93.33, 96.67, 96.67, 93.33, 93.33, 90, 93.33, 93.33, 93.33)
column2 <- rep(c("SF36", "SF12"), c(12, 12))
column3 <- rep(c("1/12", "2/12", "3/12", "4/12", "5/12", "6/12", "7/12", "8/12", "9/12", "10/12", "11/12", "12/12"), 2)
column3 <- factor(column3, levels=c("1/12", "2/12", "3/12", "4/12", "5/12", "6/12", "7/12", "8/12", "9/12", "10/12", "11/12", "12/12"))
data2 <- data.frame(column1, column2, column3)
xyplot(column1~column3, data=data2, groups=column2, lwd=2, col=c("black", "black"), lty=c(1, 2), pch=2, type="o", ylab=list(label="% of People who Answered", cex=2), scales=list(x=list(cex=2, rot=90), y=list(cex=2)), xlab=list(label="Proportion of Survey Progressed Through", cex=2), auto.key=list(space="top", columns=2, title="Group", cex.title=2, lines=TRUE, points=FALSE, cex=2))
尝试通过 par.settings
参数设置绘图参数:
xyplot(column1~column3, data=data2, groups=column2,
par.settings = list(superpose.line = list(col = "black",
lty = c(1, 2),
lwd = 2),
superpose.symbol = list(pch = 2, col = "black")),
type="o",
ylab=list(label="% of People who Answered", cex=2),
scales=list(x=list(cex=2, rot=90), y=list(cex=2)),
xlab=list(label="Proportion of Survey Progressed Through", cex=2),
auto.key=list(space="top", columns=2, title="Group", cex.title=2,
lines=TRUE, points=FALSE, cex=2))
输出:
你好,下面是使用 lattice 创建的图。我正在使用 lty=c(1, 2) 所以线条是黑色的但是有两种类型。然而,在钥匙中,线条颜色为蓝色和粉红色?我不确定如何纠正这个问题。谢谢!
column1 <- c(89.66, 89.66, 93.10, 96.55, 86.21, 89.66, 86.21, 79.31, 79.31, 79.31, 89.66, 82.76, 100, 93.33, 90, 93.33, 96.67, 96.67, 93.33, 93.33, 90, 93.33, 93.33, 93.33)
column2 <- rep(c("SF36", "SF12"), c(12, 12))
column3 <- rep(c("1/12", "2/12", "3/12", "4/12", "5/12", "6/12", "7/12", "8/12", "9/12", "10/12", "11/12", "12/12"), 2)
column3 <- factor(column3, levels=c("1/12", "2/12", "3/12", "4/12", "5/12", "6/12", "7/12", "8/12", "9/12", "10/12", "11/12", "12/12"))
data2 <- data.frame(column1, column2, column3)
xyplot(column1~column3, data=data2, groups=column2, lwd=2, col=c("black", "black"), lty=c(1, 2), pch=2, type="o", ylab=list(label="% of People who Answered", cex=2), scales=list(x=list(cex=2, rot=90), y=list(cex=2)), xlab=list(label="Proportion of Survey Progressed Through", cex=2), auto.key=list(space="top", columns=2, title="Group", cex.title=2, lines=TRUE, points=FALSE, cex=2))
尝试通过 par.settings
参数设置绘图参数:
xyplot(column1~column3, data=data2, groups=column2,
par.settings = list(superpose.line = list(col = "black",
lty = c(1, 2),
lwd = 2),
superpose.symbol = list(pch = 2, col = "black")),
type="o",
ylab=list(label="% of People who Answered", cex=2),
scales=list(x=list(cex=2, rot=90), y=list(cex=2)),
xlab=list(label="Proportion of Survey Progressed Through", cex=2),
auto.key=list(space="top", columns=2, title="Group", cex.title=2,
lines=TRUE, points=FALSE, cex=2))
输出: