heat map plugin creating incorrect output
See original GitHub issueThe heat map plugin is not generating correct output, to test I have added 6 points with a weight and color gradient. The expected output should have these points at different colors
Any ideas what may be going wrong? I suspect underlying js works on count and ignore weights
import folium
from folium import plugins
m = folium.Map(location=[43.46811941, -90.04569087], zoom_start=5)
data = [[42.35810000, -71.06360000, 0.3],
[42.82995815, -74.78991444, 0.4],
[43.17929819, -78.56603306, 0.5],
[43.40320216, -82.37774519, 0.6],
[43.49975489, -86.20965845, 0.7],
[43.46811941, -90.04569087, 0.8],]
# Uncommenting following does not work either
# append 0.0 and 10 to check if color scaling works correctly
# data.append([0,0,0.0])
# data.append([0,0,1.0])
# define color map
colormap = {0.0: 'pink', 0.3: 'blue', 0.5: 'green', 0.7: 'yellow', 1.0: 'red'}
m.add_children(plugins.HeatMap(data, min_opacity=1, max_val=1.0, gradient=colormap))
m.save('123.html')`
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Metadata layers are displayed incorrectly on results produced ...
Metadata layers are displayed incorrectly on results produced by the tool Create Heat Map for RNA-Seq - QIAGEN Digital Insights.
Read more >Problem with Heatmap plotting by folium.plugins
I need the data to be an array that combines latitude, longitude, and the three values I want to make into a heat...
Read more >How to use Heatmap plugin and its output?
Run the heat map plugin according to the instructions. Modifying the radius param should give you results consistent with the scale in the ......
Read more >Aurora Heatmap – WordPress plugin
A simple WordPress heatmap that can be completed with just a plugin. ... The name “Aurora Heatmap” visualizes user behavior with a beautiful...
Read more >Creating Heatmaps (QGIS3) - QGIS Tutorials and Tips
Notice that OUTPUT layer in the Layers panel has a legend but the 2019-02-surrey-street layer does not. A common problem with using a...
Read more >Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We should add another template for heatmap.js which does the right thing and has a plugin for leaflet. Note the current library and the one I mention have similar names heat_map.js (creates incorrect output) vs heatmap.js (creates correct output)
Here are the links Heatmap.js: https://github.com/pa7/heatmap.js Leaflet plugin: https://github.com/pa7/heatmap.js/tree/master/plugins
I know this issue is old but this may be usefull for other people :
Your min_opacity is at 1 so there is no possible gradiant. Your minimum values will be displayed with the same opacity as your maximum value. Try this code instead :
The base gradiant seems to have fixed values that go between 0 and 4000. So 0 is pink and 4000 is red in your gradiant. In order to display the values between 0 and 1, you have to put max_val at 0.00025.