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

Inconsistent setting of lineend in draw_key_* #4653

Closed
thomasp85 opened this issue Oct 29, 2021 · 1 comment · Fixed by #4664
Closed

Inconsistent setting of lineend in draw_key_* #4653

thomasp85 opened this issue Oct 29, 2021 · 1 comment · Fixed by #4664
Labels
bug an unexpected problem or unintended behavior

Comments

@thomasp85
Copy link
Member

How lineend is set in the draw_key functions does not seem to be standardised and e.g. differs between draw_key_polygon() and draw_key_path(). In general this is not an issue when the linetype is solid as the ends of the lines are not visible, but once the line is non-solid the lineend will be applied to each segment in the line-pattern. This can result in some dramatic visual discrepancies between what is shown in different keys and in the plot itself.

Example of difference in look between plot and legend as well as difference between polygon and path key:

ggplot() + 
  geom_segment(
    aes(x = 0, y = 0:1, xend = 1, yend = 1:0, linetype = c('a', 'b')), 
    size = 1.5, 
    lineend = 'round'
  ) + 
  geom_polygon(
    aes(x = c(0.25, 0.75, 0.5), y = c(0.12, 0.12, 0.88), linetype = 'b'), 
    fill = NA, 
    size = 1.5, 
    colour = 'red'
  ) + 
  scale_linetype_manual(values = c('solid', '11'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@thomasp85 and others