Hi
I'm trying to create a combined scale (proto?) but I am stuck in how to combine scales.
Here is a reprex of the problem. It would be great with a tip for a general solution that I can use to combine many scale_xxx parameters.
library(ggplot2)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, fill = Species, colour = Species)) +
geom_point(size = 3, shape = 21) +
scale_color_manual(values = c('darkred', 'darkblue', 'darkgreen')) +
scale_fill_manual(values = c('red', 'blue', 'green'))
# # Don't know how to combine scales/ protos
scale_custom <- function(p) {
p +
scale_color_manual(values = c('darkred', 'darkblue', 'darkgreen')) +
scale_fill_manual(values = c('red', 'blue', 'green'))
}
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, fill = Species, colour = Species)) +
geom_point(size = 3, shape = 21) +
scale_custom()
#> Error in scale_custom(): argument "p" is missing, with no default
Created on 2019-11-29 by the reprex package (v0.3.0)