library(ggplot2)
p <- ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point() +
scale_color_manual(values = c("red", "green", "blue"))
# Get suggestions
gg_suggest_fixes(p)
# Auto-fix the plot
p_fixed <- gg_suggest_fixes(p, auto_fix = TRUE)
Run the code above in your browser using DataLab