Skip to content

Commit

Permalink
styler
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jan 19, 2024
1 parent 692c906 commit f5340be
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: osmplotr
Title: Bespoke Images of 'OpenStreetMap' Data
Version: 0.3.4.009
Version: 0.3.4.010
Authors@R:
c(person(given = "Mark",
family = "Padgham",
Expand Down
58 changes: 29 additions & 29 deletions R/add-osm-objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ add_osm_objects <- function (map, obj, col = "gray40", border = NA, hcol,

map <- map +
ggplot2::geom_polygon (
ggplot2::aes (group = id),
data = xy1,
linewidth = size,
fill = col,
colour = border
ggplot2::aes (group = id),
data = xy1,
linewidth = size,
fill = col,
colour = border
)

if (nrow (xy_not1) > 0) {
Expand All @@ -129,9 +129,9 @@ add_osm_objects <- function (map, obj, col = "gray40", border = NA, hcol,
}
map <- map +
ggplot2::geom_polygon (
ggplot2::aes (group = id),
data = xy_not1,
fill = hcols
ggplot2::aes (group = id),
data = xy_not1,
fill = hcols
)
}
}
Expand All @@ -141,34 +141,34 @@ add_osm_objects <- function (map, obj, col = "gray40", border = NA, hcol,
xy <- list2df (xy)
map <- map +
ggplot2::geom_polygon (
ggplot2::aes (group = id),
data = xy,
linewidth = size,
fill = col,
colour = border
ggplot2::aes (group = id),
data = xy,
linewidth = size,
fill = col,
colour = border
)
} else if (grepl ("line", obj_type)) {

xy <- geom_to_xy (obj, obj_type)
xy <- list2df (xy, islines = TRUE)
map <- map +
ggplot2::geom_path (
data = xy,
ggplot2::aes (x = lon, y = lat),
colour = col,
linewidth = size,
linetype = shape
data = xy,
ggplot2::aes (x = lon, y = lat),
colour = col,
linewidth = size,
linetype = shape
)
} else if (grepl ("point", obj_type)) {

xy <- geom_to_xy (obj, obj_type)
map <- map +
ggplot2::geom_point (
data = xy,
ggplot2::aes (x = lon, y = lat),
col = col,
size = size,
shape = shape
data = xy,
ggplot2::aes (x = lon, y = lat),
col = col,
size = size,
shape = shape
)
} else {
stop ("obj is not a spatial class")
Expand Down Expand Up @@ -230,13 +230,13 @@ default_shape <- function (obj_type, shape) {

if (!is.numeric (shape)) {
warning (
"shape should be numeric; defaulting to ",
shape_default
"shape should be numeric; defaulting to ",
shape_default
)
} else if (shape < 0) {
warning (
"shape should be positive; defaulting to ",
shape_default
"shape should be positive; defaulting to ",
shape_default
)
}
}
Expand Down Expand Up @@ -286,8 +286,8 @@ geom_to_xy <- function (obj, obj_type) {
names (xy) <- c ("lon", "lat")
} else if (obj_type %in% c ("polygons", "lines")) { # sp
xy <- lapply (slot (obj, obj_type), function (x) {
slot (slot (x, cap_first (obj_type)) [[1]], "coords")
})
slot (slot (x, cap_first (obj_type)) [[1]], "coords")
})
} else if (obj_type == "points") { # sp
xy <- data.frame (slot (obj, "coords"))
}
Expand Down
3 changes: 2 additions & 1 deletion R/colour-mat.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ plot_colourmat <- function (carr) {
par (mar = rep (0, 4))
plot (NULL, NULL,
xlim = c (0, dim (carr) [2]),
ylim = c (0, dim (carr) [1]))
ylim = c (0, dim (carr) [1])
)
for (i in seq (dim (carr) [1])) {
for (j in seq (dim (carr) [2])) {
rect (j - 1, i - 1, j, i, col = carr [i, j])
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci/osmplotr",
"issueTracker": "https://github.com/ropensci/osmplotr/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.3.4.009",
"version": "0.3.4.010",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down

0 comments on commit f5340be

Please sign in to comment.