I'm trying to give a combined color scheme in spatial plot using ggplot2 this way:
- A Factor (2 levels) variable is used to select the tint (in my case, orange or blue)
- A continuous variable is used to select the saturation
I found no easier way to do that than stacking two plots, the upper one a grey gradient to simulate saturation:
ggplot(data = italian.regions) +
geom_sf(fill = c("#BFD6FF", "#FFEBBF")[as.numeric(as.factor(regions.lookup$`engine.top`))], lwd = .2) +
geom_sf(aes(fill = regions.lookup$`engine.diff`), lwd = .2, alpha = .3) +
scale_fill_gradient(high = "#666666", low = "#EFEFEF")
I use the aestethic to fill the gradient and this works. This is an example plot:
But (of course) the color legend refers to the aesthetic but it should be much more meaningful to have one describing the discrete values in 'engine.top'.
Is it possible to do so? is there an easier way to have a two-tonal, gradient color scheme without stacking two plots?