leafletCN icon indicating copy to clipboard operation
leafletCN copied to clipboard

Is it available if only display regional map?

Open fengfengyuyu opened this issue 7 years ago • 1 comments

Is it available if only display regional map? i.e. I wanna show china map in the graph without showing any other countries.

fengfengyuyu avatar Jan 16 '18 03:01 fengfengyuyu

Just don't use addTiles() or amap() in leaflet

library(leaflet)
library(leafletCN)
dat = data.frame(regionNames("china"),
                 runif(34))
map = leafletGeo("china", dat)

pal <- colorNumeric(
  palette = "Blues",
  domain = map$value)

leaflet(map) %>%
# addTiles() %>%
  addPolygons(stroke = TRUE,
              smoothFactor = 1,
              fillOpacity = 0.7,
              weight = 1,
              color = ~pal(value),
              popup = ~htmltools::htmlEscape(popup)
  ) %>%
  addLegend("bottomright", pal = pal, values = ~value,
            title = "legendTitle",
            labFormat = leaflet::labelFormat(prefix = ""),
            opacity = 1)

image

Lchiffon avatar Jun 20 '18 02:06 Lchiffon