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

Fix linewidth of draw_key_polygon() #5815

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Mar 28, 2024

This PR aims to fix #4852.

Briefly, draw_key_polygon() used to cap the linewidth aesthetic to some portion of the key size. Now that we can let the grobs contribute to key sizes, it is more straightforward to use that mechanism than have the legend display incorrect linewidths.

A reprex similar to the one in the issue:

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

exp_df <- data.frame(x = letters[1:3], size = c(1, 4, 16))
ggplot(exp_df, aes(x, 1L, linewidth = size)) +
  geom_col(colour = "black", fill = "transparent") +
  scale_linewidth_identity(guide = "legend")

Created on 2024-03-28 with reprex v2.1.0

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

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.

Legend for geom_col()'s size does not correctly depict change in size
2 participants