Skip to content

Absent legend titles take up no space - #5452

Merged
teunbrand merged 4 commits into
tidyverse:mainfrom
teunbrand:absent_legend_title
Oct 9, 2023
Merged

teunbrand merged 4 commits into
tidyverse:mainfrom
teunbrand:absent_legend_title

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR aims to fix #3587.

Briefly, if the legend title produces a <zeroGrob> object, such as by setting theme(legend.title = element_blank()), it now no longer takes up space. This makes it easier to align legends to plot panels.

The implementation is pretty straightforward: all title-specific adjustments are made conditional.

@teunbrand
teunbrand marked this pull request as ready for review October 4, 2023 13:35

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand
teunbrand merged commit 6dd9bb6 into tidyverse:main Oct 9, 2023
@teunbrand
teunbrand deleted the absent_legend_title branch October 9, 2023 17:09
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.

Remove space for legend title if it doesn't have a title

2 participants