Skip to content

Convert size = NA to 0 before rendering guide_legend#4672

Merged
thomasp85 merged 1 commit into
mainfrom
issue-4559-size-NA
Nov 16, 2021
Merged

Convert size = NA to 0 before rendering guide_legend#4672
thomasp85 merged 1 commit into
mainfrom
issue-4559-size-NA

Conversation

@thomasp85

Copy link
Copy Markdown
Member

Fix #4559

This is a simple fix that converts all instances of NA in the size aesthetic to 0

@paleolimbot paleolimbot 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.

Great!

Comment thread R/guide-legend.r
# override.aes in guide_legend manually changes the geom
data <- modify_list(data, guide$override.aes)

if (!is.null(data$size)) {

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.

I forget if data is a data.frame here, but if it is, I wonder of "size" %in% names(data) is a bit better (lest data ever become a tibble)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We have this pattern all over the place so once we begin to accept tibbles inside the code we will have a lot of places to fix up

@thomasp85 thomasp85 merged commit 073c9a0 into main Nov 16, 2021
@thomasp85 thomasp85 deleted the issue-4559-size-NA branch November 16, 2021 20:01
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.

Setting size = NA on a geom causes error in legend generation

2 participants