Skip to content

Commit 8211e6c

Browse files
committed
Expose shape argument in geom_curve() (#5998)
1 parent c495e9b commit 8211e6c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

R/geom-curve.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
GeomCurve <- ggproto(
77
"GeomCurve", GeomSegment,
88

9-
draw_panel = function(data, panel_params, coord, curvature = 0.5, angle = 90,
10-
ncp = 5, arrow = NULL, arrow.fill = NULL, lineend = "butt", na.rm = FALSE) {
9+
draw_panel = function(data, panel_params, coord, curvature = 0.5, angle = 90, ncp = 5, shape = 0.5,
10+
arrow = NULL, arrow.fill = NULL, lineend = "butt", na.rm = FALSE) {
1111

1212
if (!coord$is_linear()) {
1313
cli::cli_warn("{.fn geom_curve} is not implemented for non-linear coordinates")
@@ -31,11 +31,13 @@ GeomCurve <- ggproto(
3131

3232
arrow.fill <- arrow.fill %||% trans$colour
3333

34+
square <- (ncp == 1 && angle == 90)
35+
3436
curveGrob(
3537
trans$x, trans$y, trans$xend, trans$yend,
3638
default.units = "native",
37-
curvature = curvature, angle = angle, ncp = ncp,
38-
square = FALSE, squareShape = 1, inflect = FALSE, open = TRUE,
39+
curvature = curvature, angle = angle, ncp = ncp, shape = shape,
40+
square = square, squareShape = 1, inflect = FALSE, open = TRUE,
3941
gp = gg_par(
4042
col = alpha(trans$colour, trans$alpha),
4143
fill = alpha(arrow.fill, trans$alpha),

0 commit comments

Comments
 (0)