Skip to content

Instantly share code, notes, and snippets.

@gmbecker
Created November 15, 2016 20:16
Show Gist options
  • Save gmbecker/4f09eb7c5d7289a3892c4d395d7c1701 to your computer and use it in GitHub Desktop.
Save gmbecker/4f09eb7c5d7289a3892c4d395d7c1701 to your computer and use it in GitHub Desktop.
legend title ggplot
## this worked for me
df = data.frame("omg" = factor(sample(1:2, 100, replace=TRUE)), x = rnorm(100), y = rnorm(100))
ggplot(data=df) + aes(x = x, y = y, color = omg) + geom_point() + scale_colour_discrete(guide_legend(title="whaaat?\nok!"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment