Skip to content

Set defaults in text based keys #5587

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 3 commits into from
Dec 15, 2023
Merged

Conversation

teunbrand
Copy link
Collaborator

This PR fixes a bug introduced in #5562.

Briefly, I forgot to set proper defaults for some values that would make draw_key_text() and draw_key_label() incompatible with non-text geoms. In this PR, these defaults are set, so you can mix the text key with a point layer, for example.

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

ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) +
  geom_point(key_glyph = "text")

ggplot(mpg, aes(displ, hwy, colour = factor(cyl))) +
  geom_point(key_glyph = "label")

Created on 2023-12-15 with reprex v2.0.2

@teunbrand teunbrand requested a review from thomasp85 December 15, 2023 09:53
@teunbrand teunbrand added this to the ggplot2 3.5.0 milestone Dec 15, 2023
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

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

LGTM

@teunbrand
Copy link
Collaborator Author

Thanks Thomas!

@teunbrand teunbrand merged commit 1159837 into tidyverse:main Dec 15, 2023
@teunbrand teunbrand deleted the fix_text_keys branch December 15, 2023 10:32
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.

2 participants