Skip to content

Remove shape as non-missing aes in geom_segment() #5546

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 1 commit into from
Dec 6, 2023

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #5517.

geom_segment() no longer drops rows with missing shape aesthetic, as shape doesn't actually correspond to a property of the line that is being drawn.

Reprex from #5517:

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

df <- data.frame(
  x = 0, 
  xend = 1, 
  y = c(0, 1), 
  yend = c(1, 0), 
  shape = c("A", NA)
)

ggplot(df, aes(x, y, xend = xend, yend = yend)) +
  geom_segment(aes(shape = shape))
#> Warning in geom_segment(aes(shape = shape)): Ignoring unknown aesthetics: shape

Created on 2023-11-29 with reprex v2.0.2

@teunbrand teunbrand added this to the ggplot2 3.5.0 milestone Dec 5, 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 for the review Thomas!

@teunbrand teunbrand merged commit 41587fc into tidyverse:main Dec 6, 2023
@teunbrand teunbrand deleted the geom_segment_remove_shape branch December 6, 2023 10:36
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.

Remove shape as aesthetic in geom_segment()?
2 participants