Skip to content
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

We can do better text/label keys now #5561

Closed
teunbrand opened this issue Dec 4, 2023 · 0 comments · Fixed by #5562
Closed

We can do better text/label keys now #5561

teunbrand opened this issue Dec 4, 2023 · 0 comments · Fixed by #5562

Comments

@teunbrand
Copy link
Collaborator

For both label and text keys, the size of the label aesthetic isn't communicated properly. If the label isn't the default "a", this lets text go out of the bounds of the key area. Moreover, the label keys don't really look like labels as they appear in the plot.

With #5465 in place, we can now assign the appropriate size for label and text keys.

A slightly contrived example to show the issue with the current keys:

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

ggplot(mpg, aes(displ, hwy, label = class, colour = class)) +
  geom_text(angle = 45) +
  discrete_scale(
    "label", palette = identity_pal(), super = ScaleDiscreteIdentity
  )

ggplot(mpg, aes(displ, hwy, label = class, colour = class)) +
  geom_label(angle = -45) +
  discrete_scale(
    "label", palette = identity_pal(), super = ScaleDiscreteIdentity
  )

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

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 a pull request may close this issue.

1 participant