Closed
Description
When using it with lines, the observations get flagged as missing and get removed.
library(ggplot2)
p <- ggplot(data.frame(x = 1:2, y = 1:2), aes(x, y))
p + geom_line(linetype = NA)
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_line()`).
However, if we don't throw away such observations, we invite errors from grid.
p + geom_tile(linetype = NA)
#> Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : invalid line type
Created on 2025-01-06 with reprex v2.1.1
This can be painful when using scales, as in #6097 we've changed scale_linetype()$na.value
to NA
.
My suggestion for non-line geometries is to translate these NA
s to "blank"
or 0, depending on the type.