3

Basically, I tried to use colors to show the value, however, when I add a legend, the color in legend doesn't match the color in the map.

enter image description here output$map <- renderLeaflet({ temp<-data[data$coralType==input$type,] temp<- aggregate(temp,by=list(temp$location),FUN=mean) #print(temp) qpal <- colorQuantile("YlOrRd", temp$value,n=6) leaflet(temp) %>% addProviderTiles("Esri.WorldImagery") %>% addCircleMarkers(~longitude,~latitude,radius =~value*35,color=~qpal(value), label=paste(paste(temp$Group.1,":"),temp$value),fillOpacity =0.8) %>% addLegend("topright", pal = qpal, values = ~value, title = "Average Rate", opacity = 1) })

IvanSanchez
  • 18,272
  • 3
  • 30
  • 45
Eric
  • 56
  • 3

1 Answers1

1

Not sure if this helps, but shortly before you posted this question, a similar question appeared on git: https://github.com/r-spatial/mapview/issues/219 I'm having a similar issue but with legends that use nominal data (not ramped gradients).

Shawn Janzen
  • 369
  • 3
  • 15