Legends in ggplot2

Working with legends in ggplot2 can be challenging. Here is a collection of DictionR snippets that will help you navigate legends in ggplot2.

Hide part or all of the legend

Hide the legend in a plot · #65
Discover how to hide the legend in a plot in R
Hide a legend in the legend · #73
Discover how to hide a legend in the legend in R

Move the legend around

Move the legend around a plot · #74
Discover how to move the legend around a plot in R
Change the justification of the legend · #75
Discover how to change the justification of the legend in R

Customize the legend

Change the title of a legend · #71
Discover how to change the title of a legend in R
Change the direction of items in a legend · #78
Discover how to change the direction of items in a legend in R

Customize a legend with multiple legends

Hide a legend in the legend · #73
Discover how to hide a legend in the legend in R
Combine multiple legends in the legend · #72
Discover how to combine multiple legends in the legend in R
Change the justification of multiple legends in the legend · #76
Discover how to change the justification of multiple legends in the legend in R
Change the direction of multiple legends in the legend · #77
Discover how to change the direction of multiple legends in the legend in R

Access ready-to-use R code snippets

Unlock now