我的目标是在 map 上创建曲线(连接点),在一侧有一个箭头.这些线将是半透明的.似乎实现我的目标的最好方法是使用geom_curve
(尽管其他ggplot2
解决方案也会很好).
因此,假设我有这样一个玩具情节:
library(tidyverse)
library(ggplot2)
data <- data.frame(x = 4, y = 20, xend = 7, yend = 15)
ggplot(data) + geom_curve(aes(x = x, y = y, xend = xend, yend = yend),
arrow = arrow(length = unit(0.17, "npc"), type="closed", angle=20),
colour = "red",
linewidth = 5,
angle = 90,
alpha=.2,
lineend = "butt",
curvature = -0.4,
)
我面临的问题是,当我使用带有半透明线的geom_curve
时,当我希望它是统一的时,箭头显示出不同级别的透明度.我如何才能防止这种情况发生?
This question is very closely related to: Alpha aesthetic shows arrow's skeleton instead of plain shape - how to prevent it?, except that it uses geom_curve
instead of geom_segment
. The brilliant answer (https://stackoverflow.com/a/60587296/2049545) defines a new geometry (geom_arrowbar
). Would it be possible to modify this to be used for geom_curve
? I will also flag another of the answers that points to geom_gene_arrow
(https://stackoverflow.com/a/60655018/2049545) - can this be used with curved lines? Or is there some other solution that would work?