I'm developing a plot of proportionally sized arrows, and have a workflow for size, direction and arrow-head size, but there are a couple of issues with the arrowheads: 1. they have rounded line-join and 2. they don't close (see bottom right corner) even when type='closed'
.
require(ggplot2)
require(grid)
d = data.frame(x = 1:10, y = 0, size = 1:10)
ggplot(d, aes(x, y, size = size)) +
geom_segment(aes(xend = x, yend = y + size),
arrow = arrow(length = unit(d$size, "mm"), type='closed')) +
scale_size(range = c(2, 4))
Arrows are based on grid graphics, but I cannot figure out how to specify the setting. get.gpar()
yields:
$lineend
[1] "round"
$linejoin
[1] "round"
but gpar(linejoin = 'mitre', lineend = 'butt')
does not change this. Is there any way to change these settings? Thanks in advance.
Edit
Plot image including grid.segments arrow added:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…