Skip to content

Commit

Permalink
fixed #867, also fixed bug in convert2density checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Apr 26, 2024
1 parent 9c7c410 commit 203bc2c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/step1_helper_facets.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ step1_rearrange_facets = function(tmo, o) {
if (is.null(sunit)) sunit = o$unit
shape.unit <- ifelse(sunit=="metric", "km", ifelse(sunit=="imperial", "mi", sunit))
u = paste(shape.unit, shape.unit)
shp[[v]] = shp[[v]] / units::set_units(shp$AREA, u, mode = "standard")
if (is.numeric(shp[[v]])) shp[[v]] = shp[[v]] / units::set_units(shp$AREA, u, mode = "standard")
}
}

Expand Down
2 changes: 1 addition & 1 deletion R/step4_helper_legends.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ step4_plot_collect_legends = function(tmx) {
# find shared legends

icon_scales = vapply(legs2, function(l) {
as.numeric(l$icon_scale)
as.numeric(l$icon_scale[1])
}, FUN.VALUE = numeric(1))
icon_scale = if (any(icon_scales != 1)) icon_scales[which(icon_scales != 1)[1]] else 1

Expand Down
4 changes: 4 additions & 0 deletions R/v4_v3.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ v3_use_component = function(arg = "title", comp = "tm_title", container = "tm_fo
message(paste0("[v3->v4] ", container, "(): use ", comp, "() instead of the argument '", arg, "'"))
}

v3_convert2density = function(layer_fun) {
message(paste0("[v3->v4] ", layer_fun, "(): convert2density is deprecated: divide the variable values by the polygon areas manually (obtain the areas with 'sf::st_area()')"))
}

v3_tm_scale_instead_of_style = function(style, scale_fun, vv, layer_fun, arg_list) {
if (scale_fun == "intervals") {
arg_list$old = c("style", arg_list$old)
Expand Down

0 comments on commit 203bc2c

Please sign in to comment.