r-tmap / tmap

R package for thematic maps
https://r-tmap.github.io/tmap
GNU General Public License v3.0
868 stars 121 forks source link

tmap_mode("view") no longer hides the legend #920

Closed marine-ecologist closed 3 months ago

marine-ecologist commented 3 months ago

Screenshot 2024-08-25 at 5 51 05 AM

Reproducible example below:

library(sf)
library(tmap)
library(leaflet)
library(leaflet.extras)

particles <- st_as_sf(data.frame(
  id = 1:1000,
  x = runif(1000, 4, 5),
  y = runif(1000, 4.8, 5.8),
  z = runif(1000, 0, 100)
), coords = c("x", "y"), crs = 4326)

tmap_mode("view")
tmp <- 
  tm_shape(particles, name="Z levels") +
  tm_symbols(size=0.5,
             shp=21,
             fill="z",
             fill.scale = tmap::tm_scale_continuous(values="reds"),
             fill.legend = tmap::tm_legend(name = "Z levels")) 
tmp
mtennekes commented 3 months ago

Nice find, thx! Working now.