Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/refine markers #46

Merged
merged 4 commits into from
Jun 22, 2023
Merged

Feat/refine markers #46

merged 4 commits into from
Jun 22, 2023

Conversation

jack-davison
Copy link
Collaborator

@jack-davison jack-davison commented Jun 22, 2023

This PR fixes #45.

In short, it changes this (verbose, repetitive):

leaflet() %>%
  addTiles() %>%
  addPolarMarkers(
    data = polar_data,
    pollutant = "ws",
    fun = openair::windRose,
    group = "Wind Rose"
  ) %>%
  addPolarMarkers(
    data = polar_data,
    pollutant = "nox",
    fun = openair::polarPlot,
    group = "Polar Plot"
  ) %>%
  addLayersControl(
    baseGroups = c("Wind Rose", "Polar Plot")
  )

To this (shorter, cleaner):

leaflet(data = polar_data) %>%
  addTiles() %>%
  addPolarMarkers("ws",
    fun = openair::windRose,
    group = "Wind Rose"
  ) %>%
  addPolarMarkers("nox",
    fun = openair::polarPlot,
    group = "Polar Plot"
  ) %>%
  addLayersControl(
    baseGroups = c("Wind Rose", "Polar Plot")
  )

The original will still work, but the newer syntax is a lot nicer to use if all of the polar markers are originating from the same dataset.

Also applies to addPolarDiffMarkers() and addTrajPaths(). In the first instance, both "before" and "after" inherit from leaflet(), so the user should override at least one.

@jack-davison jack-davison self-assigned this Jun 22, 2023
@jack-davison jack-davison added enhancement New features map:polar 🧭 Anything to do with polar marker maps, e.g., polarMap() labels Jun 22, 2023
@jack-davison jack-davison merged commit 3c89ee8 into master Jun 22, 2023
3 checks passed
@jack-davison jack-davison deleted the feat/refine-markers branch June 22, 2023 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features map:polar 🧭 Anything to do with polar marker maps, e.g., polarMap()
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: addPolarMarkers() should use leaflet::getMapData()
1 participant