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 24, 2024
1 parent 4f82d39 commit f0a222e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
akgfmaps 3.5.4 (September 18, 2024)
akgfmaps 3.5.4 (September 23, 2024)
----------------------------------------------------------------

BUG FIX
Expand Down
22 changes: 17 additions & 5 deletions R/make_idw_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,23 @@ make_idw_map <- function(x = NA,
vec <- sub("\\,", "", vec)
vec <- sub("\\]", "", 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)))
if(length(sig.dig) > 0) {

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

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

for(j in 1:length(sig.dig)) {
vec <- sub(pattern = sig.dig.desc[j], replacement = sig.dig.format[j], x = vec)
Expand Down
26 changes: 20 additions & 6 deletions R/make_idw_stack.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,28 @@ make_idw_stack <- function(x = NA,
vec <- sub("\\,", "", vec)
vec <- sub("\\]", "", 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)))
if(length(sig.dig) > 0) {

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

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

for(j in 1:length(sig.dig)) {
vec <- sub(pattern = sig.dig.desc[j], replacement = sig.dig.format[j], x = vec)
vec <- sub(pattern = sig.dig.desc[j],
replacement = sig.dig.format[j],
x = vec)
}
}
return(vec)
Expand Down

0 comments on commit f0a222e

Please sign in to comment.