【发布时间】:2021-07-09 17:38:22
【问题描述】:
我无法将 WBank 线设为虚线,并且它在图例中也显示为虚线。这是我到目前为止所写的:
ggplot(data = Differences_TODO, aes(x = Years,y= MeanDifference))+geom_line(aes(color=region)) +
labs(x = "Figure 2 (Modified) - Extra hours to get to work in Israel by region of residence" , y = "Extra Hours")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),legend.position = c(0.2,0.8))+
scale_x_continuous(n.breaks = 10) +
scale_linetype_manual(values=c("solid","dotted")) +
theme(legend.title=element_blank()) +
scale_color_manual(values = c("black", "black"))
【问题讨论】:
-
您需要指定您想要使用线型作为美学。试试
geom_line(aes(linetype=region)) -
谢谢!效果很好