I am working in the next code: ggplot()+ geom_sf(data = DPEst_DH, aes(size = di1a), col="orangered")
that works.
But I want a colored legend.
In other words, I want apply the same field at two aesthetics, size and color but keeping one legend.
...+ geom_sf(data = DPEst_DH, aes(color=di1a, size=di1a))
With that code line I have the next output but I want to know if is possible to have something like the last image.
One option to achieve your desired result would be to make your
di1a
column a discrete variable using e.g.cut
and to set the colors and sizes viascale_xxx_manual
.Making use of the
nc
shape file shipped with thesf
package as example data: