37
37
autoplot.spatial_rset <- function (object , ... , alpha = 0.6 ) {
38
38
bool_id_columns <- grepl(" ^id" , names(object ))
39
39
# Not sure how this would ever fire, but just in case:
40
- if (sum(bool_id_columns ) > 2 ) rlang :: abort(
41
- " Cannot automatically plot rsets with more than two 'id' columns."
42
- )
40
+ if (sum(bool_id_columns ) > 2 ) {
41
+ rlang :: abort(
42
+ " Cannot automatically plot rsets with more than two 'id' columns."
43
+ )
44
+ }
43
45
# These are named to not interfere with normal column names
44
46
.fold. <- .facet. <- NULL
45
47
@@ -90,8 +92,10 @@ autoplot.spatial_rsplit <- function(object, ..., alpha = 0.6) {
90
92
object $ .class. [outs ] <- " Assessment"
91
93
object $ .class. [is.na(object $ .class. )] <- " Buffer"
92
94
93
- p <- ggplot2 :: ggplot(data = object ,
94
- mapping = ggplot2 :: aes(color = .class. , fill = .class. ))
95
+ p <- ggplot2 :: ggplot(
96
+ data = object ,
97
+ mapping = ggplot2 :: aes(color = .class. , fill = .class. )
98
+ )
95
99
p <- p + ggplot2 :: guides(
96
100
colour = ggplot2 :: guide_legend(" Class" ),
97
101
fill = ggplot2 :: guide_legend(" Class" )
@@ -107,7 +111,9 @@ autoplot.spatial_rsplit <- function(object, ..., alpha = 0.6) {
107
111
autoplot.spatial_block_cv <- function (object , show_grid = TRUE , ... , alpha = 0.6 ) {
108
112
p <- autoplot.spatial_rset(object , ... , alpha = alpha )
109
113
110
- if (! show_grid ) return (p )
114
+ if (! show_grid ) {
115
+ return (p )
116
+ }
111
117
112
118
data <- object $ splits [[1 ]]$ data
113
119
@@ -136,5 +142,4 @@ autoplot.spatial_block_cv <- function(object, show_grid = TRUE, ..., alpha = 0.6
136
142
# Always prints with "Coordinate system already present. Adding new coordinate system, which will replace the existing one."
137
143
# So this silences that
138
144
suppressMessages(p + ggplot2 :: geom_sf(data = grid_blocks , fill = NA ))
139
-
140
145
}
0 commit comments