ggarrow icon indicating copy to clipboard operation
ggarrow copied to clipboard

Visual bug: corners

Open teunbrand opened this issue 1 year ago • 0 comments

When points are spaced more densely than the linewidth, a glitch can occur at corners where a sharp angle transitions into a smooth curve.

library(ggarrow)
#> Loading required package: ggplot2
t <- seq(0, 2 * pi, length.out = 1000)

df <- data.frame(
  x = c(0.25, sin(t) + seq(0, 2, length.out = 1000), 1.75),
  y = c(2, cos(t), 2)
)

ggplot(df, aes(x, y)) +
  geom_arrow(linewidth = 5, colour = "white", stroke_colour = "black") +
  annotate("point", x = 0, y = 1, colour = 2, shape = 1, size = 20) +
  coord_equal()

Created on 2023-01-31 with reprex v2.0.2

Related question on SO: https://stackoverflow.com/questions/74331763/offsetting-a-polyline-in-one-direction-part-ii

teunbrand avatar Jan 31 '23 07:01 teunbrand