geomtextpath icon indicating copy to clipboard operation
geomtextpath copied to clipboard

Different behavior for line breaks when there's no data

Open brunomioto opened this issue 1 year ago • 0 comments

ggplot2 doesn't plot the line inside geom_line() when there's NAs values, but geomtextpath plots it. Is there a way to have the same behavior using geom_textline()?

I tried aes(group = 1) but it didn't help.

library(dplyr)
library(ggplot2)
library(geomtextpath)

data <- tibble(
  x = seq(1,20,1),
  y = c(rnorm(10),rep(NA,4), rnorm(6))
)


data %>% 
  ggplot(aes(x = x, y = y))+
  geom_line()+
  geom_point()
#> Warning: Removed 4 rows containing missing values (`geom_point()`).

data %>% 
  ggplot(aes(x = x, y = y))+
  geom_textline(label = "test", hjust = 0.95)+
  geom_point()
#> Warning: Removed 4 rows containing missing values (`geom_textline()`).
#> Warning: Removed 4 rows containing missing values (`geom_point()`).

Created on 2023-07-20 with reprex v2.0.2

brunomioto avatar Jul 21 '23 01:07 brunomioto