我刚刚使用下面的代码创建了一个散点图。有人知道如何自定义图例标题和标签?
x <- ggplot(full_data)
x + geom_point(aes(y=r_morning_noon_no_min,x=as.integer(rownames(full_data)),col=ifelse(prediction==1,'green','red'))) +
geom_hline(yintercept = mean_rm,color="red") +
geom_hline(yintercept = mean_rm2,color="green") +
ggtitle("Muster von skalierten Haushalten nach Pensionierung separiert") +
labs(x="Haushalt ID")
答案 0 :(得分:-1)
scale_color_manual(name="xxx",values=c("red","green"),labels=c("xxx","xxx"))