问题
Is there anyway to change the color of leaflet line base on the value of some variable? I google it, and found this link.
However, I was wondering if there is a simple way to do it with leaflet in R. I tried something like:
data <- data.frame(long = runif(40,-10,10), lat = runif(40,50,60), speed = runif(40,0,100))
leaflet(data) %>% addTiles() %>% addPolylines(lng = ~long, lat = ~lat, color = ~speed)
but, it shows only one color.
来源:https://stackoverflow.com/questions/40948167/change-color-of-leaflet-line-accordingly-with-a-vector