r-tmap / r-tmap/tmap

Adjust symbol size when zooming in interactive view mode

Open
#609 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

View-mode
Dominant language
R
Stars
907
Forks
123
PR merge metrics
No merged PRs in 30d

Description

In the current view mode, the symbol size is constant when zooming in and out of the map. I would like to have the symbol size adapt automatically or manually based on the zoom level (e.g., bigger on higher-level zoom and smaller on lower level zoom). This function is automatically achieved in leaflet when you addCircleMarkers(). https://rstudio.github.io/leaflet/markers.html

I tried setting the symbol.size.fixed argument in tm_view to FALSE and it does not work. There seems to be a possibility to wrap leaflet functions in tmap through the leaflet.options, but I don't know how to do it correctly.

Currently, my workaround is just to use leaflet like the link above (or see below example). I would love to be able to do that through tmap so that I don't have to introduce another package in my tutorial.

leaflet(df) %>% addTiles() %>%
  addCircleMarkers(
    radius = ~degree,
    color = ~pal(type),
    stroke = FALSE, fillOpacity = 0.5
  )

Let me know if this is possible? Many thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the tm_view argument handling and the leaflet.options integration mentioned in the issue, then compare the requested behavior with leaflet's addCircleMarkers() example. Done should mean that symbol size can adapt to zoom level in tmap, with the intended behavior verified in an appropriate example or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.