The legend for d2
looks fine; for d1
, I would like to show just the hoizontal line against a white/transparent backgounnd.
df = data.frame(
Date = c("2012-11-30", "2012-12-03", "2012-12-04"),
d1 = c(9, 5, 11),
d2 = c(4, 6, 3)
)
ggplot(df, aes(Date)) +
geom_bar(aes(y = d2, color = "d2"), stat="identity", fill = "red") +
geom_line(aes(y = d1, group = 1, color = "d1")) +
scale_colour_manual("", values=c("d1" = "blue", "d2" = "red"))
See Question&Answers more detail:os