From 973f143c8a71db237c8f8a26c2e49573aa9c665e Mon Sep 17 00:00:00 2001 From: Jack Davison Date: Sun, 28 Apr 2024 13:17:55 +0100 Subject: [PATCH] fix: `networkMap()` refinements Fixes GR10/GR2.5 and hydrocarbons appearing in the legend --- NEWS.md | 2 ++ R/network_networkMap.R | 5 +++-- R/utilities.R | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index e2f109b..0812582 100644 --- a/NEWS.md +++ b/NEWS.md @@ -42,6 +42,8 @@ * "illegal" file path characters can now be used in the columns provided to the `type` argument of the `polarMap()` family. Most relevant to most users is that this will allow them to provide their own custom HTML tags - e.g., for formatting superscripts, subscripts, and so on. +* The colours in the legend of `networkMap()` now better align with the actual colours of the markers, and the layer control menu when `control = "variable"` is now presented in a nicer order with clearer labels. + # openairmaps 0.8.1 This is a minor release of `{openairmaps}`, released mainly to fix an issue with `{ggmap}` but also adding some new functionality for polar marker maps. diff --git a/R/network_networkMap.R b/R/network_networkMap.R index 825005d..f785ed0 100644 --- a/R/network_networkMap.R +++ b/R/network_networkMap.R @@ -330,7 +330,7 @@ networkMap <- map, position = control.position, options = leaflet::layersControlOptions(collapsed = control.collapsed, autoZIndex = FALSE), - baseGroups = quickTextHTML(sort(control_vars)), + baseGroups = sort(quickTextHTML(control_vars)), overlayGroups = names(provider) ) %>% leaflet::hideGroup(group = names(provider)[[-1]]) @@ -477,7 +477,8 @@ prepNetworkData <- function(source, year) { "135TMB", "c2PENTEN", "MEPENT", - "3MEPENT" + "3MEPENT", + "NAPHTH" ) meta <- dplyr::filter( diff --git a/R/utilities.R b/R/utilities.R index d2d1a13..5d7f8d5 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -65,6 +65,9 @@ quickTextHTML <- function(text) { text <- gsubic("pmcoarse", "PMcoarse", text) text <- gsubic("pmf", "PMfine", text) text <- gsubic("pmfine", "PMfine", text) + text <- gsubic("gr25", "PM2.5 (grav.)", text) + text <- gsubic("gr2.5", "PM2.5 (grav.)", text) + text <- gsubic("gr10", "PM10 (grav.)", text) # units text <- gsub("ug/m3", "\u00B5g m-3", text)