I'm attempting to overlay two plots with ggplot2. I don't have any problems doing it with scale_x_manual (as it's described in other question), but it crashes when I have to use scale_color_gradient...
My code is:
ggplot() +
geom_point(data = mtcars, aes(x = mpg, y = qsec, color = qsec)) +
scale_color_gradient(low = "gray", high = "blue") +
geom_point(data = mtcars, aes(x = drat, y = wt, color = wt)) +
scale_color_gradient(low = "gray", high = "red")
But it prompts this message and only keeps one scale:
Scale for 'colour' is already present.
Adding another scale for 'colour', which will replace the existing scale.
I've tried different options (scale_color_manual, scale_fill_gradient, scale_color_gradient2 or scale_color_gradientn...) but nothing seems to work. Please, any suggestions? Thanks for your help!