Last updated on August 13, 2025
Removing legends in ggplot2 is a common requirement when creating clean, professional data visualizations. While legends help identify different groups or categories, there are situations where they become redundant, clutter the plot, or aren’t needed for your specific visualization goals.
In this comprehensive ggplot2 legend removal tutorial, you’ll discover 4 different methods to remove legends from your R plots. Whether you’re preparing publication-ready figures, creating dashboard visualizations, or simply cleaning up your plots, these techniques will give you complete control over legend display.
4 Methods to Remove ggplot2 Legends
Quick overview of techniques covered:
-
theme(legend.position="none")– Remove all legends at once -
guides(color="none")– Remove specific legend types selectively -
show.legend=FALSE– Disable legends within individual geom layers -
easy_remove_legend()– Use the ggeasy package for simplified syntax
Adding legend to a plot is often helpful to easily understand a plot. However there are scenarios legends can be redundant or we don’t need them.
In ggplot2, we have multiple options to remove legend in a plot. In this tutorial we will see four ways to remove legend with examples.
Let us load the packages needed.
library(tidyverse) theme_set(theme_bw(16))
How to remove legend in ggplot2
Let us make a plot with ggplot2 with legend added by color argument to aes() in the boxplot below. Note we can also add legend with fill argument to aes() function in the plot belpw.
mpg |>
ggplot(aes(y = fct_reorder(manufacturer, cty),
x = cty,
color=manufacturer))+
geom_boxplot()+
labs(y="manufacturer")
ggsave("how_to_remove_legend_in_ggplot.png")

1. Removing legend with theme()
One of the ways to remove legends in a ggplot is to use theme() layer with legend.position=”none’ argument. This will remove all the legends in the plot.
mpg |>
ggplot(aes(y = fct_reorder(manufacturer, cty),
x=cty,
color=manufacturer))+
geom_boxplot()+
labs(y="manufacturer")+
theme(legend.position="none")
ggsave("remove_legend_in_ggplot_with_theme.png")

2. Removing legend with guides()
mpg |>
ggplot(aes(y = fct_reorder(manufacturer, cty),
x=cty,
color=manufacturer))+
geom_boxplot()+
labs(y="manufacturer")+
guides(color="none")
ggsave("remove_legend_in_ggplot_with_guides.png")

Removing legend with show.legend=FALSE inside geom_*()
We can also remove legend using show.legend=FALSE within geom_*. In this example we use show.legend=FALSE argument inside geom_boxplot().
mpg |>
ggplot(aes(y = fct_reorder(manufacturer, cty),
x = cty,
color=manufacturer))+
geom_boxplot(show.legend=FALSE)+
labs(y="manufacturer")
ggsave("remove_legend_in_ggplot_with_show_legend.png")

Removing legend with ggeasy’s easy_remove_legend()
Fourth way to remove legend that may be easy to remember is to use ggeasy package and use the function easy_remove_legend().
library(ggeasy)
mpg |>
ggplot(aes(y = fct_reorder(manufacturer, cty),
x=cty,
color=manufacturer))+
geom_boxplot()+
labs(y="manufacturer")+
easy_remove_legend()
ggsave("remove_legend_in_ggplot_with_ggeasy.png")

Explore the Complete ggplot2 Guide
35+ tutorials with code: scatterplots, boxplots, themes, annotations, facets, and more—tested and beginner-friendly.
Visit the ggplot2 Hub → No fluff—just code and visuals.


