Skip to content

Convert size = NA to 0 before rendering guide_legend #4672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

thomasp85
Copy link
Member

Fix #4559

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

Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

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

Great!

@@ -278,6 +278,10 @@ guide_geom.legend <- function(guide, layers, default_mapping) {
# override.aes in guide_legend manually changes the geom
data <- modify_list(data, guide$override.aes)

if (!is.null(data$size)) {
Copy link
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
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