Tutorial5 min read

How to Remove Legend Title in ggplot2 (The Easy Way)

By Francesco Villasmunta
How to Remove Legend Title in ggplot2 (The Easy Way)

Whether you want to remove the legend title in ggplot2, hide the legend entirely, or customize it—this is your complete reference. All methods, one page.

How to Remove Legend Title in ggplot2

The most common solution—add this to your plot:

+ theme(legend.title = element_blank())

This removes the legend title while keeping the legend itself visible.

How to Remove the Entire Legend in ggplot2

Need to hide the legend completely? Use one of these:

# Method 1: theme()
+ theme(legend.position = "none")
# Method 2: guides()
+ guides(fill = "none") # or color = "none"
# Method 3: Inside geom
geom_point(aes(color = Group), show.legend = FALSE)

How to Remove Fill Legend Title in ggplot2

When you've mapped to fill and want to remove just that title:

+ guides(fill = guide_legend(title = NULL))

Replace fill with color, size, or shape as needed.

How to Change (Not Remove) the Legend Title

If you want to rename the legend title instead of removing it:

# Using labs()
+ labs(fill = "Treatment Group")
# Using scale functions
+ scale_fill_discrete(name = "Treatment Group")

Complete Example

library(ggplot2)

ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
  geom_point(size = 3) +
  theme_minimal() +
  theme(legend.title = element_blank()) # Removes "Species" title

Quick Reference Table

What You WantCode
Remove legend titletheme(legend.title = element_blank())
Remove entire legendtheme(legend.position = "none")
Hide specific legendguides(fill = "none")
Change legend titlelabs(fill = "New Title")

Skip the Syntax Entirely

Tired of memorizing ggplot2 syntax? With Plotivy, you just describe what you want in plain English:

  • "Remove the legend title"
  • "Hide the legend"
  • "Change legend title to Treatment Group"
  • "Move legend to the bottom"

The AI understands and generates the correct Python code instantly. No more Stack Overflow searches.

Try Natural Language Plotting

Stop googling syntax. Just describe what you want.

Create a Plot with AI →

Start Analyzing Today

You don't need to be a data scientist to analyze data like one. Try Plotivy and turn your data into insights in minutes.

Get Started for Free →
Tags:#ggplot2#R#legend#tutorial#ggplot remove legend#ggplot remove legend title#ggplot2 remove legend#ggplot hide legend