8000
Skip to content

geom_segment and geom_curve discrepancy #5831

Description

@agneeshbarua

Greetings,

I am trying to use geom_curve to connect points on a plot but have been getting an error. I am not sure why I am getting "end points must not be identical error" as geom_segment which uses the same code, works perfectly. I'll need to connect the points as curved lines, hence the preference of using geom_cuve

library(tidyverse)

dtc<-tibble(node = c("A","B","C"),x_connect = c(60,32,80),y_connect = c(39,88,110))

# geom_segment  works fine
ggplot(dtc)+geom_point(aes(x = x_connect,y = y_connect),size=5)+
  geom_segment(aes(x = x_connect, y = y_connect,xend = lead(x_connect), yend = lead(y_connect)))
#> Warning: Removed 1 row containing missing values or values outside the scale range
#> (`geom_segment()`).

# geom_curve does not
ggplot(dtc)+geom_point(aes(x = x_connect,y = y_connect),size=5)+
  geom_curve(aes(x = x_connect, y = y_connect,xend = lead(x_connect), yend = lead(y_connect)))
#> Error in if (any(x1 == x2 & y1 == y2)) stop("end points must not be identical"): missing value where TRUE/FALSE needed

Created on 2024-04-08 with reprex v2.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorlayers 📈

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0