Skip to content

Commit b8f7924

Browse files
committed
add curly braces
1 parent 86b32ce commit b8f7924

13 files changed

+100
-33
lines changed

R/coord-.R

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ Coord <- ggproto("Coord",
6262
# Should any of the scales be reversed?
6363
reverse = "none",
6464

65-
aspect = function(ranges) NULL,
65+
aspect = function(ranges) {
66+
NULL
67+
},
6668

6769
labels = function(self, labels, panel_params) {
6870
labels
@@ -177,15 +179,23 @@ Coord <- ggproto("Coord",
177179
panel_params
178180
},
179181

180-
transform = function(data, range) NULL,
182+
transform = function(data, range) {
183+
NULL
184+
},
181185

182-
distance = function(x, y, panel_params) NULL,
186+
distance = function(x, y, panel_params) {
187+
NULL
188+
},
183189

184-
is_linear = function() FALSE,
190+
is_linear = function() {
191+
FALSE
192+
},
185193

186194
# Does the coordinate system support free scaling of axes in a faceted plot?
187195
# Will generally have to return FALSE for coordinate systems that enforce a fixed aspect ratio.
188-
is_free = function() FALSE,
196+
is_free = function() {
197+
FALSE
198+
},
189199

190200
setup_params = function(self, data) {
191201
list(expand = parse_coord_expand(self$expand %||% TRUE))

R/coord-cartesian-.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,13 @@ coord_cartesian <- function(xlim = NULL, ylim = NULL, expand = TRUE,
8686
#' @export
8787
CoordCartesian <- ggproto("CoordCartesian", Coord,
8888

89-
is_linear = function() TRUE,
90-
is_free = function() TRUE,
89+
is_linear = function() {
90+
TRUE
91+
},
92+
93+
is_free = function() {
94+
TRUE
95+
},
9196

9297
distance = function(x, y, panel_params) {
9398
max_dist <- dist_euclidean(panel_params$x$dimension(), panel_params$y$dimension())

R/coord-fixed.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ coord_equal <- coord_fixed
4646
#' @usage NULL
4747
#' @export
4848
CoordFixed <- ggproto("CoordFixed", CoordCartesian,
49-
is_free = function() FALSE,
49+
is_free = function() {
50+
FALSE
51+
},
5052

5153
aspect = function(self, ranges) {
5254
diff(ranges$y.range) / diff(ranges$x.range) * self$ratio

R/coord-polar.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ coord_polar <- function(theta = "x", start = 0, direction = 1, clip = "on") {
8080
#' @export
8181
CoordPolar <- ggproto("CoordPolar", Coord,
8282

83-
aspect = function(details) 1,
83+
aspect = function(details) {
84+
1
85+
},
8486

85-
is_free = function() TRUE,
87+
is_free = function() {
88+
TRUE
89+
},
8690

8791
distance = function(self, x, y, details, boost = 0.75) {
8892
arc <- self$start + c(0, 2 * pi)

R/coord-radial.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ CoordRadial <- ggproto("CoordRadial", Coord,
140140
diff(details$bbox$y) / diff(details$bbox$x)
141141
},
142142

143-
is_free = function() TRUE,
143+
is_free = function() {
144+
TRUE
145+
},
144146

145147
distance = function(self, x, y, details, boost = 0.75) {
146148
arc <- details$arc %||% c(0, 2 * pi)

R/coord-sf.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,15 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
302302
},
303303

304304
# CoordSf enforces a fixed aspect ratio -> axes cannot be changed freely under faceting
305-
is_free = function() FALSE,
305+
is_free = function() {
306+
FALSE
307+
},
306308

307309
# for regular geoms (such as geom_path, geom_polygon, etc.), CoordSf is non-linear
308310
# if the default_crs option is being used, i.e., not set to NULL
309-
is_linear = function(self) is.null(self$get_default_crs()),
311+
is_linear = function(self) {
312+
is.null(self$get_default_crs())
313+
},
310314

311315
distance = function(self, x, y, panel_params) {
312316
d <- self$backtransform_range(panel_params)
@@ -327,7 +331,9 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
327331
diff(panel_params$y_range) / diff(panel_params$x_range) / ratio
328332
},
329333

330-
labels = function(labels, panel_params) labels,
334+
labels = function(labels, panel_params) {
335+
labels
336+
},
331337

332338
render_bg = function(self, panel_params, theme) {
333339
el <- calc_element("panel.grid.major", theme)

R/coord-transform.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ coord_trans <- function(x = "identity", y = "identity", xlim = NULL, ylim = NULL
111111
#' @usage NULL
112112
#' @export
113113
CoordTrans <- ggproto("CoordTrans", Coord,
114-
is_free = function() TRUE,
114+
115+
is_free = function() {
116+
TRUE
117+
},
118+
115119
distance = function(self, x, y, panel_params) {
116120
max_dist <- dist_euclidean(panel_params$x.range, panel_params$y.range)
117121
dist_euclidean(self$trans$x$transform(x), self$trans$y$transform(y)) / max_dist

R/facet-.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ Facet <- ggproto("Facet", NULL,
9898
map_data = function(data, layout, params) {
9999
cli::cli_abort("Not implemented.")
100100
},
101-
setup_panel_params = function(self, panel_params, coord, ...) panel_params,
101+
setup_panel_params = function(self, panel_params, coord, ...) {
102+
panel_params
103+
},
102104
init_scales = function(layout, x_scale = NULL, y_scale = NULL, params) {
103105
scales <- list()
104106
if (!is.null(x_scale)) {
@@ -161,7 +163,7 @@ Facet <- ggproto("Facet", NULL,
161163
params
162164
)
163165

164-
# Draw individual panels, then call `$draw_panels()` method to
166+
# Draw individual panels, then call `$draw_panels()` method to
165167
# assemble into gtable
166168
lapply(seq_along(panels[[1]]), function(i) {
167169
panel <- lapply(panels, `[[`, i)

R/geom-.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,13 @@ Geom <- ggproto("Geom",
109109
cli::cli_abort("{.fn {snake_class(self)}}, has not implemented a {.fn draw_group} method")
110110
},
111111

112-
setup_params = function(data, params) params,
112+
setup_params = function(data, params) {
113+
params
114+
},
113115

114-
setup_data = function(data, params) data,
116+
setup_data = function(data, params) {
117+
data
118+
},
115119

116120
# Combine data with defaults and set aesthetics from parameters
117121
use_defaults = function(self, data, params = list(), modifiers = aes(),

R/geom-blank.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ geom_blank <- function(mapping = NULL, data = NULL,
3535
#' @export
3636
GeomBlank <- ggproto("GeomBlank", Geom,
3737
default_aes = aes(),
38-
handle_na = function(data, params) data,
38+
handle_na = function(data, params) {
39+
data
40+
},
3941
check_constant_aes = FALSE,
40-
draw_panel = function(...) nullGrob()
42+
draw_panel = function(...) {
43+
nullGrob()
44+
}
4145
)

0 commit comments

Comments
 (0)