Skip to content

Reign in overly ambitious arrow() in geom_path() - #5078

Merged
teunbrand merged 6 commits into
tidyverse:mainfrom
teunbrand:arrow_path
Mar 23, 2023
Merged

teunbrand merged 6 commits into
tidyverse:mainfrom
teunbrand:arrow_path

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR aims to fix #4935.

Visually, it brings the !constant --> segmentsGrob() code branch in line with to the polylineGrob() branch.

The polylineGrob() branch:

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

data <- tibble::tibble(
  t = seq(5, -1, length.out = 100) * pi,
  x = sin(t) * 1:100,
  y = cos(t) * 1:100,
  group = 0:99 %/% 20
)

p <- ggplot(data, aes(x = x, y = y, group = group))

p + geom_path(arrow = arrow())

The segmentsGrob() branch:

p + geom_path(aes(colour = t), arrow = arrow())

Mixed use of arrow ends:

p + geom_path(
  aes(colour = t), 
  arrow = arrow(ends = c("last", "both", "first", "both", "last"))
)

Created on 2022-12-03 by the reprex package (v2.0.1)

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I've wanted to do this forever so happy to see it done...

@teunbrand
teunbrand merged commit 375a24b into tidyverse:main Mar 23, 2023
@teunbrand
teunbrand deleted the arrow_path branch March 23, 2023 21:25
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.

aes(color) causes arrow() to become overly enthusiastic

2 participants