Skip to content

Commit

Permalink
Fix label formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-rohan-NOAA committed Sep 20, 2024
1 parent 1c4d3e5 commit 4f82d39
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 82 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Package: akgfmaps
Type: Package
Title: Alaska Groundfish and Ecosystem Survey Area Mapping
Version: 3.5.3
Version: 3.5.4
Date: 2024-09-20
Authors@R: c(person("Sean", "Rohan", email = "[email protected]", role = c("aut", "cre")),
person("Emily", "Markowitz", email = "[email protected]", role = "ctb"),
person("Zack", "Oyafuso", email = "[email protected]", role = "ctb"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export(make_wkt_table)
export(rasterize_and_mask)
export(reproject_gebco)
export(transform_data_frame_crs)
import(dplyr)
import(here)
import(sf)
importFrom(classInt,classIntervals)
Expand Down
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
akgfmaps 3.5.4 (September 18, 2024)
----------------------------------------------------------------

BUG FIX

- Fix label formatting issue in make_idw_map() and
make_idw_stack().


akgfmaps 3.5.3 (May 22, 2024)
----------------------------------------------------------------

Expand Down
12 changes: 9 additions & 3 deletions R/make_idw_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#' (6) key.title: title for the legend;
#' (7) crs: coordinate reference system as a PROJ6 (WKT2:2019) string;
#' @author Sean Rohan \email{sean.rohan@@noaa.gov}
#' @import dplyr
#' @importFrom classInt classIntervals
#' @export

Expand Down Expand Up @@ -197,10 +198,15 @@ make_idw_map <- function(x = NA,
vec <- sub("\\(", "\\>", vec)
vec <- sub("\\,", "", vec)
vec <- sub("\\]", "", vec)
vec <- sub("-Inf", "", vec)

if(length(sig.dig) > 3) {

sig.dig.format <- trimws(format(sort(sig.dig, decreasing = TRUE), nsmall=0, big.mark=","))

sig.dig.desc <- trimws(format(sort(sig.dig, decreasing = TRUE)))

for(j in 1:length(sig.dig)) {
vec <- sub(sig.dig[j], format(sig.dig[j], nsmall=0, big.mark=","), vec)
vec <- sub(pattern = sig.dig.desc[j], replacement = sig.dig.format[j], x = vec)
}
}
return(vec)
Expand All @@ -220,7 +226,7 @@ make_idw_map <- function(x = NA,
sf::st_as_sf() |>
dplyr::select(-var1.var) |>
dplyr::group_by(var1.pred) |>
dplyr::summarise(n = n()) |>
dplyr::summarise(n = dplyr::n()) |>
sf::st_intersection(map_layers$survey.area)

extrap.grid <- extrap.grid |>
Expand Down
Loading

0 comments on commit 4f82d39

Please sign in to comment.