How to change the title, caption, filter and export the Map in pdf using leaflet in R?

Asked

Viewed 169 times

3

I created a map of MG to identify the Qtde of consultations by mining municipality. I got the code below on the internet and it worked. But I would like to add some more information, but I’m not getting it. It’s them:

1) Place the title of the chart at the top of the map (or if possible, disassemble as I do to move it).

2) Insert a legend with the color scales, for example (from 0 to 500 queries a light shade of blue; from 501 to 1000 queries a darker shade of blue and so on etc)

3) As my interest is only in the municipalities of MG, it would be possible to show, in the result, only the map of MG instead of the whole world map?

4) How to export the map to pdf?

Code used to chart:

pal <- colorBin("Blues",domain = NULL,n=5) #cores do mapa

state_popup <- paste0("<strong>Município: </strong>", 
                      MUNICIPIOS_MG$NM_MUNICIP, 
                      "<br><strong> Qtde Consultas Eletivas: </strong>", 
                      MUNICIPIOS_MG$QTD_CONSULTAS)
leaflet(data = MUNICIPIOS_MG) %>%
  addProviderTiles("CartoDB.Positron") %>%
  addPolygons(fillColor = ~pal(MUNICIPIOS_MG$QTD_CONSULTAS), 
              fillOpacity = 0.9, 
              color = "#BDBDC3", 
              weight = 1, 
              popup = state_popup) %>%
  addLegend("bottomright", pal = pal, values = ~MUNICIPIOS_MG$QTD_CONSULTAS,
            title = "QUANTIDADE DE CONSULTAS ELETIVAS",
            opacity = 1)

Thank you.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.