change legend title in ggplot

PHOTO EMBED

Mon Jul 31 2023 17:08:11 GMT+0000 (Coordinated Universal Time)

Saved by @vs #r

# using fill
ggplot2::ggplot(data, ggplot2::aes(x = x, y = y, fill = category)) +
  ggplot2::labs(fill = "New Legend Title")

# using color
ggplot2::ggplot(data, ggplot2::aes(x = x, y = y, color = category)) +
  ggplot2::labs(color = "New Legend Title")
content_copyCOPY