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

Is it available if only display regional map? #6

Open
fengfengyuyu opened this issue Jan 16, 2018 · 1 comment
Open

Is it available if only display regional map? #6

fengfengyuyu opened this issue Jan 16, 2018 · 1 comment

Comments

@fengfengyuyu
Copy link

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

@Lchiffon
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants