Someone reported an issue in ggdag with dashed arrows with solid arrowheads (r-causal/ggdag#216). I checked both ggplot2 and ggraph, and it seems like this may be an issue in ggplot2.
Creating a dashed line with a solid arrowhead results in visual artifacts. It looks like the dashed line might ALSO have an arrowhead behind it
library(ggplot2)
library(grid)
df <- data.frame(
x = c(0, 0),
y = c(0, 0.5),
xend = c(1, 1),
yend = c(0, 0.5),
linetype = c("solid", "dashed")
)
ggplot(df) +
geom_segment(
aes(x, y, xend = xend, yend = yend, linetype = linetype),
linewidth = 1,
arrow = arrow(length = unit(0.3, "cm"), type = "closed")
) +
coord_fixed(xlim = c(-0.1, 1.1), ylim = c(-0.2, 0.9)) +
scale_linetype_identity() +
theme_void()

Created on 2025-11-17 with reprex v2.1.1