Skip to content

Fix guide_bins() when the data has no size - #3593

Merged
yutannihilation merged 2 commits into
tidyverse:masterfrom
yutannihilation:fix/issue-3582-guide-bin-no-sizes
Nov 4, 2019
Merged

yutannihilation merged 2 commits into
tidyverse:masterfrom
yutannihilation:fix/issue-3582-guide-bin-no-sizes

Conversation

@yutannihilation

Copy link
Copy Markdown
Member

Fix #3582

The result of do.call("cbind", lapply(guide$geoms, function(g) g$data$size / 10)) can be an empty matrix, which cannot be subsetted. I guess the branch if (nrow(key_size_mat) == 0 || ncol(key_size_mat) == 0) { is prepared to handle this.

@clauswilke

Copy link
Copy Markdown
Member

Do you want to add a small comment about the empty matrix issue to the code? I generally think that whenever we identify these kinds of potential problems, it makes sense to point them out in the code, so somebody else doesn't repeat the mistake in the future.

@yutannihilation

Copy link
Copy Markdown
Member Author

Thanks, I will.

@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

@yutannihilation

Copy link
Copy Markdown
Member Author

Thanks.

@yutannihilation
yutannihilation merged commit bad6f38 into tidyverse:master Nov 4, 2019
@yutannihilation
yutannihilation deleted the fix/issue-3582-guide-bin-no-sizes branch November 4, 2019 09:37
@lock

lock Bot commented May 5, 2020

Copy link
Copy Markdown

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock Bot locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report a bug of guide-bins: it cannot work with geom_sf.

3 participants