Color Scale in leaflet

Hey guys, trying to scale in color my leaflet map. See what I tried:

raio is the filter that I used to obtain the data I want

 raio <- shiny::reactive({ %>% 
                                                dplyr::select(lat, lon, input$cultivoTB1, ANO, MUNICIPIO, ESTADO) %>% 
                                                dplyr::filter(ANO == input$anoTB1pizza, ESTADO == "MG") %>% 
                                                dplyr::mutate(ESTADO = NULL))

then I tried to build a reactive pal, since input$cultivoTB1 will change accordingly to the user choice:

      pal <- reactive({
        leaflet::colorBin("YlOrRd", domain = raio()[, 3])


         leaflet::leafletProxy("bbmap", data = raio) %>% 
         leaflet::clearShapes() %>%           
         leaflet::addPolygons(data = teste,
                            weight = 0.3,
                            opacity = 1,
                            color = "black",
                            **fillColor = ~pal(raio()[, 3])**,
                            popup = stringr::str_c("MunicĂ­pio: ",
                            raio()[, 5],
                            "Valor Produzido: R$ ",
                            signif(raio()[, 3]*1000, digits = 5),
                            "Cultivo: ",
                            "Ano: ",
                            raio()[, 4]))

It seems that fillColor funcion does not work that way... I need some help here. Thanks!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.