diff --git a/NEWS.md b/NEWS.md index e19471d2e2..836e815171 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # ggplot2 (development version) +* `linetype = NA` is now interpreted to mean 'no line' instead of raising errors + (@teunbrand, #6269). * `geom_ribbon()` now appropriately warns about, and removes, missing values (@teunbrand, #6243). * `guide_*()` can now accept two inside legend theme elements: diff --git a/R/utilities-grid.R b/R/utilities-grid.R index c231f0b279..a935d5b38f 100644 --- a/R/utilities-grid.R +++ b/R/utilities-grid.R @@ -41,6 +41,9 @@ gg_par <- function(..., stroke = NULL, pointsize = NULL) { stroke[is.na(stroke)] <- 0 args$fontsize <- pointsize * .pt + stroke * .stroke / 2 } + if (!is.null(args$lty) && anyNA(args$lty)) { + args$lty[is.na(args$lty)] <- if (is.character(args$lty)) "blank" else 0 + } inject(gpar(!!!args)) }