tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.4k stars 2k forks source link

Fix missing margin error in `guide_custom()` #5858

Closed teunbrand closed 2 months ago

teunbrand commented 2 months ago

This PR aims to fix #5856.

It just falls back to an empty margin() when it was not declared in the theme.

Reprex from issue:

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

ggplot(mpg, aes(displ, hwy)) + 
  geom_point() + 
  guides(custom = guide_custom(grid::circleGrob(),
                               title = "My circle",
                               width = unit(2, "cm"),
                               height = unit(2, "cm"))) +
  theme_void()

Created on 2024-04-23 with reprex v2.1.0

thomasp85 commented 2 months ago

/document