I want to use facet_wrap
in a way that it allows every subplot have their own legend depending on the e.g. max and min values within each subplot.
When I do:
library(ggplot2)
ggplot(mtcars, aes(cyl, mpg, col = hp)) +
geom_point() +
scale_color_viridis_c() +
facet_wrap(. ~ hp)
I get:
But, the problem here is that I get a common legend, which I do not want. How can I use facet_wrap
(or any other technique that I may not know) to make subplots have their own legend?