我已经为 R 中的住房成本和住房收入比率变量设置了时间序列折线图,但我没有成功地为每个变量指定不同的点符号,如其他帖子中所建议的那样。我收到以下错误消息“连续变量无法映射到形状”(简化为两个变量):
ggplot(housing, aes(year)) +
geom_line(aes(y = Greenwich, colour = "Greenwich"))+
geom_point(aes(y = Greenwich, colour = "Greenwich", shape = 1)) +
scale_shape_identity() + #added missing "+"
geom_line(aes(y = median, colour = "median"))+
geom_point(aes(y = median, colour = "median", shape = 2)) + # added missing parenthesis
scale_shape_identity() + # removed extra parenthesis
ylab("house price to earnings (lower quartile)")+
theme(legend.title=element_blank())
欢迎提出任何建议。