|
3 | 3 | #' @format NULL
|
4 | 4 | #' @usage NULL
|
5 | 5 | #' @export
|
6 |
| -GeomCurve <- ggproto("GeomCurve", GeomSegment, |
| 6 | +GeomCurve <- ggproto( |
| 7 | + "GeomCurve", GeomSegment, |
7 | 8 |
|
8 |
| - default_aes = aes( |
9 |
| - colour = from_theme(ink), |
10 |
| - linewidth = from_theme(linewidth), |
11 |
| - linetype = from_theme(linetype), |
12 |
| - alpha = NA |
13 |
| - ), |
| 9 | + default_aes = aes( |
| 10 | + colour = from_theme(ink), |
| 11 | + linewidth = from_theme(linewidth), |
| 12 | + linetype = from_theme(linetype), |
| 13 | + alpha = NA |
| 14 | + ), |
14 | 15 |
|
15 |
| - draw_panel = function(data, panel_params, coord, curvature = 0.5, angle = 90, |
16 |
| - ncp = 5, arrow = NULL, arrow.fill = NULL, lineend = "butt", na.rm = FALSE) { |
| 16 | + draw_panel = function(data, panel_params, coord, curvature = 0.5, angle = 90, |
| 17 | + ncp = 5, arrow = NULL, arrow.fill = NULL, lineend = "butt", na.rm = FALSE) { |
17 | 18 |
|
18 |
| - if (!coord$is_linear()) { |
19 |
| - cli::cli_warn("{.fn geom_curve} is not implemented for non-linear coordinates") |
20 |
| - } |
21 |
| - data <- remove_missing( |
22 |
| - data, na.rm = na.rm, |
23 |
| - c("x", "y", "xend", "yend", "linetype", "linewidth"), |
24 |
| - name = "geom_curve" |
25 |
| - ) |
| 19 | + if (!coord$is_linear()) { |
| 20 | + cli::cli_warn("{.fn geom_curve} is not implemented for non-linear coordinates") |
| 21 | + } |
| 22 | + data <- remove_missing( |
| 23 | + data, na.rm = na.rm, |
| 24 | + c("x", "y", "xend", "yend", "linetype", "linewidth"), |
| 25 | + name = "geom_curve" |
| 26 | + ) |
26 | 27 |
|
27 |
| - trans <- coord$transform(data, panel_params) |
| 28 | + trans <- coord$transform(data, panel_params) |
28 | 29 |
|
29 |
| - arrow.fill <- arrow.fill %||% trans$colour |
| 30 | + arrow.fill <- arrow.fill %||% trans$colour |
30 | 31 |
|
31 |
| - curveGrob( |
32 |
| - trans$x, trans$y, trans$xend, trans$yend, |
33 |
| - default.units = "native", |
34 |
| - curvature = curvature, angle = angle, ncp = ncp, |
35 |
| - square = FALSE, squareShape = 1, inflect = FALSE, open = TRUE, |
36 |
| - gp = gg_par( |
37 |
| - col = alpha(trans$colour, trans$alpha), |
38 |
| - fill = alpha(arrow.fill, trans$alpha), |
39 |
| - lwd = trans$linewidth, |
40 |
| - lty = trans$linetype, |
41 |
| - lineend = lineend), |
42 |
| - arrow = arrow |
43 |
| - ) |
44 |
| - } |
| 32 | + curveGrob( |
| 33 | + trans$x, trans$y, trans$xend, trans$yend, |
| 34 | + default.units = "native", |
| 35 | + curvature = curvature, angle = angle, ncp = ncp, |
| 36 | + square = FALSE, squareShape = 1, inflect = FALSE, open = TRUE, |
| 37 | + gp = gg_par( |
| 38 | + col = alpha(trans$colour, trans$alpha), |
| 39 | + fill = alpha(arrow.fill, trans$alpha), |
| 40 | + lwd = trans$linewidth, |
| 41 | + lty = trans$linetype, |
| 42 | + lineend = lineend), |
| 43 | + arrow = arrow |
| 44 | + ) |
| 45 | + } |
45 | 46 | )
|
46 | 47 |
|
47 | 48 | #' @inheritParams grid::curveGrob
|
|
0 commit comments