Skip to content

Implement geom_linerange(arrow) and geom_pointrange(arrow) #6482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to fix #6481.

Briefly, it adds the arrow and arrow.fill arguments to the geoms mentioned in the title.
Examples:

devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2

df <- data.frame(
  trt = c("A", "A", "B", "B"),
  resp = c(1, 5, 3, 4),
  group = factor(c(1, 2, 1, 2)),
  upper = c(1.1, 5.3, 3.3, 4.2),
  lower = c(0.8, 4.6, 2.4, 3.6)
)

staple <- arrow(angle = 90, length = unit(2, "mm"), ends = "both")

p <- ggplot(df, aes(trt, resp, colour = group, ymin = lower, ymax = upper))
p + geom_linerange(arrow = staple)

p + geom_pointrange(arrow = staple)

Created on 2025-05-27 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support arrow for geom_linerange() and geom_pointrange()
1 participant