trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
214 stars 74 forks source link

Appending values to colors. #107

Closed im4yush closed 6 months ago

im4yush commented 6 years ago

I'm totally new to Leaflet Heatmap. All I want to know is, how the mapping of values i.e. datapoints are appended to colors in gradients? Can I set any kind of range to those datapoints? Like, datapoints having value 5 should fall in the range of 0 - 10 and so on for others to.

bhaskarvk commented 6 years ago

I am afraid you will have to read up the Leaflet.heat code to understand what exactly goes under the hood. I am fairly busy with work stuff otherwise I would've done it myself.

ngfrey commented 6 years ago

@im4yush if you want to map a continuous value variable to a "bucketed" range, and then use colors on the grouped/bucketed/binned column, you first need to transform the continuous numeric column, then map the transformed column to your color aesthetic. Take a peek at this: https://stackoverflow.com/questions/11963508/generate-bins-from-a-data-frame. And then this: https://rstudio.github.io/leaflet/colors.html

trafficonese commented 6 months ago

I guess this is solved..