xvar 중간 값을 점선으로 표시하려고 & 범례에 표시합니다. 나는 또한 시도rggplot2의 범례가있는 geom_vline의 부적절한 선 종류
require(ggplot2)
require(scales)
medians_mtcars <- data.frame("wt.median"=median(mtcars$wt))
# legend shows but linetype is wrong (solid)
p <- ggplot(mtcars, aes(wt, mpg))
p <- p + geom_point()
p <- p + geom_vline(aes(xintercept=wt.median, linetype="dotted"),
data=medians_mtcars, show_guide=TRUE)
p
: 여기 내 코드의
# linetype is correct but legend does not show
p <- ggplot(mtcars, aes(wt, mpg))
p <- p + geom_point()
p <- p + geom_vline(aes(xintercept=wt.median),
data=medians_mtcars, show_guide=TRUE, linetype="dotted")
p
하는 것은 플롯 이미지를 게시 할 좋아했하지만, 아직 평판 임계 값을 교차하지 않았습니다.
이 주제와 관련된이 게시물에는 2 개의 다른 게시물이 있지만이 문제에 대한 해결책은 제공되지 않습니다. Add vline to existing plot and have it appear in ggplot2 legend? ; Incorrect linetype in legend, ggplot2 in R
나는 ggplot2 버전 내가 잘못 뭐하는 거지 1.0.0
을 사용하고? 사전
감사합니다. Didzis. 내 작업에 두 개 이상의 행 (예 : 평균, 중간, sd 등)이 포함되어 있으며이 게시물에 대해 단순화했습니다. 전설이 자동으로 지정된 선 종류와 함께 표시되도록 에이스 매핑에서 선 유형 상수를 어떻게 지정할 수 있는지 궁금합니다. – bdanalytics
내 대답을 업데이트하여 다른 솔루션 –
을 표시했습니다. 고마워. 이제 나는 어떤 규모의 정체성이 있는지보아야 할 필요가있다. – bdanalytics