2016-10-21 6 views
1

안녕하세요 아래 그림은 격자를 사용하여 작성한 것입니다. 나는 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)) 

답변

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)) 

출력 : enter image description here