Skip to content

Consider PANEL for handling NAs in line geoms #6541

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6533.

Briefly, line geoms require special NA-handling methods because we want to exclude terminal vertices but not internal vertices from a path. We use group to determine these, but we should consider PANEL as well.

Reprex from issue:

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

d2 <- data.frame(x = 1:3, col = c("blue", "green", NA)) |> 
  tidyr::crossing(group = c("A", "B"))

ggplot(d2, aes(x, x, color = I(col), group = 1)) +
  facet_wrap(~ group) + 
  geom_line(lwd = 2)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_line()`).

Created on 2025-07-03 with reprex v2.1.1

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.

Unexpected behaviour of colors in geom_line()
1 participant