I try to drop the legend by setting show.legend = FALSE. It works as expected when the fill variable is discrete:
library(ggplot2)
ggplot(mtcars, aes(x = mpg, y = wt, fill = factor(mpg))) +
geom_bar(stat = "identity", show.legend = FALSE)
However, when fill is mapped to a continuous variable, show.legend = FALSE does not drop the legend:
ggplot(mtcars, aes(x = mpg, y = wt, fill = mpg)) +
geom_bar(stat = "identity", show.legend = FALSE)
Why doesn't show.legend = FALSE omit the legend for a continuous scale? How can I solve this?
I have ggplot2 v.2.0.0 (author: Hadley Wickham)
