Skip to content

Commit 453cf6b

Browse files
committed
avoid arbitrary whitespace changes
1 parent 23f4c71 commit 453cf6b

File tree

1 file changed

+34
-33
lines changed

1 file changed

+34
-33
lines changed

R/geom-curve.R

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,46 @@
33
#' @format NULL
44
#' @usage NULL
55
#' @export
6-
GeomCurve <- ggproto("GeomCurve", GeomSegment,
6+
GeomCurve <- ggproto(
7+
"GeomCurve", GeomSegment,
78

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+
),
1415

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) {
1718

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+
)
2627

27-
trans <- coord$transform(data, panel_params)
28+
trans <- coord$transform(data, panel_params)
2829

29-
arrow.fill <- arrow.fill %||% trans$colour
30+
arrow.fill <- arrow.fill %||% trans$colour
3031

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+
}
4546
)
4647

4748
#' @inheritParams grid::curveGrob

0 commit comments

Comments
 (0)