Skip to content

geom_area does not align with geom_line with duplicate x coords #5227

@banbh

Description

@banbh

When x coordinates are duplicated geom_area does not align with geom_line. For example, in the following example, some of the x=2 coordinates are shifted back slightly (but visibly).

library(ggplot2) # ggplot2_3.4.1

data.frame(x = c(1,2,2,3), y = 4:1) |> 
  tidyr::crossing(id = c(0, 1e2)) |>
  ggplot(aes(x + id, y)) +
  facet_wrap(vars(id), scales = 'free_x') +
  geom_area() + # not aligned with lines from next geom_line
  geom_line()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions