Skip to content

Instantly share code, notes, and snippets.

@lilywang1988
Last active May 28, 2018 00:20
Show Gist options
  • Save lilywang1988/ed16e157596978e79c7759f68dafc578 to your computer and use it in GitHub Desktop.
Save lilywang1988/ed16e157596978e79c7759f68dafc578 to your computer and use it in GitHub Desktop.
Remove legends in ggplot

from r cookbook, where bp is your ggplot:

Remove legend for a particular aesthetic (fill):

bp + guides(fill=FALSE) It can also be done when specifying the scale:

bp + scale_fill_discrete(guide=FALSE) This removes all legends:

bp + theme(legend.position="none")

The link at the beginning includes almost all information about legend settings in ggplot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment