Closed
Description
Identity function does not position annotations where expected when x = 0. It does when x = -Inf
Not sure if this is a ggplot thing?
library(tidyverse)
library(palmerpenguins)
#>
#> Attaching package: 'palmerpenguins'
#> The following objects are masked from 'package:datasets':
#>
#> penguins, penguins_raw
p <- penguins |>
ggplot() +
geom_bar(aes(x = species), ) +
theme_classic()
p +
ggplot2::annotate(
"segment",
x = I(0),
xend = I(1),
y = c(50, 100),
yend = c(50, 100),
colour = "red"
) +
coord_cartesian(clip = "off")
p +
ggplot2::annotate(
"segment",
x = I(-Inf),
xend = I(1),
y = c(50, 100),
yend = c(50, 100),
colour = "red"
) +
coord_cartesian(clip = "off")
Created on 2025-06-05 with reprex v2.1.1
Metadata
Metadata
Assignees
Labels
No labels