Get ggplot2 legend to display percentage sign in r Get ggplot2 legend to display percentage sign in r r r

Get ggplot2 legend to display percentage sign in r


Load the scales package (you already have it, but I want to be explicit about this dependency)

library(scales)

and add labels = percent to your fill scale (or use scales::percent if you don't want to use library(scales) for whatever reason).

scale_fill_gradient(low = "red", high = "green", limits = c(-8, 8), labels = percent)