I am trying to add a legend to the qplot
generated by this code:
qplot(pa1, geom = "density", fill = I("blue"), alpha = I(0.3), label = "auto") + geom_density(aes(x = pb1), fill = "red", alpha = I(0.3), label = "brand") +
geom_density(aes(x = ph1), fill = "green", alpha = I(0.3)) + xlab("Predicted Values") +
ylab("Density") + ggtitle("Auto (blue) Brand (red) and Home (green)")
where pa1, pb1, ph1
are vectors of predictions from glm
models.
The final output works:
but no legend...