r - 用 ggplot2 添加虚线
问题描述
我无法将 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"))
解决方案
Thanks to Phil for helping out, the correct code should include geom_line(aes(linetype=region))
推荐阅读
- python - 如何从单元测试中模拟.patch 库函数
- node.js - 使用 Okta OIDC 中间件时出现“错误:状态不匹配,无法在会话中找到状态”
- smartcard - Javacard 外形规格
- python-3.x - “没有这样的文件或目录” - 但我要打开的文件就在那里
- c# - 无法排序,因为 IComparer.Compare() 方法返回不一致的结果。再次
- apache-spark - Pyspark 正确倾斜数据加盐技术示例代码
- c# - 2 如何通过在输入中使用“FlightStopsAsConnections”、“MaxStopsQuantity”或“DirectFlightsOnly”在 BargainFinderMax(REST 模式)中仅获取直飞航班
- pine-script - Pine-script SECURITY 函数不返回一致的结果
- rust - 如何仅在文档测试期间将例程标记为 pub?
- javascript - 在溢出表中粘贴表行和标题