Skip to content

✨ Manual legend: guide_legend_manual()#109

Merged
teunbrand merged 7 commits intomainfrom
legend_manual
Oct 3, 2025
Merged

✨ Manual legend: guide_legend_manual()#109
teunbrand merged 7 commits intomainfrom
legend_manual

Conversation

@teunbrand
Copy link
Copy Markdown
Owner

@teunbrand teunbrand commented Sep 28, 2025

This PR aims to fix #88.

Briefly, it allows the creation of a guide_legend_base() variant where all scale/training is under user control.
@brunomioto as you suggested this in tidyverse/ggplot2#6386, is there any chance I can get you to confirm this would solve the issue?
You can download this PR using: pak::pak("teunbrand/legendry#109")

Example:

devtools::load_all("~/packages/legendry/")
#> ℹ Loading legendry
#> Loading required package: ggplot2

ggplot(mtcars, aes(disp, mpg)) +
  geom_point() +
  guides(foobar = guide_legend_manual(
    labels = c("foo", "bar"),
    colour = c(NA, "#222222"),
    fill   = c("#d8d8d8", NA),
    layers = geom_col()
  ))

Created on 2025-09-28 with reprex v2.1.1

@teunbrand teunbrand changed the title ✨ Manual legend ✨ Manual legend: guide_legend_manual() Sep 28, 2025
@teunbrand teunbrand merged commit ca91cd1 into main Oct 3, 2025
7 checks passed
@teunbrand teunbrand deleted the legend_manual branch October 3, 2025 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re: ggplot2/#6386; allow custom legends

1 participant