Change legend scale without minima/maxima?
bariscope opened this issue · 3 comments
Hi, is it possible to modify the legend for a density map? For example, if I select colors White, Red, steps 5, and have a feature value between 0 to 100,000, the map and legend is created with 0 as White and 100,000 as red. But, I rather want it to categorize based on ranges of values. For example. <20,000, 20,000-70,000, >100,000. How is it possible to modify the legend this way?
Hi! Unless I'm misunderstanding, this should happen automatically, via the steps argument. Would you paste a code sample to illustrate what you mean? (Either here or via codepen.com)
Appreciate your help! Here is the code in codepen: https://codepen.io/turen009/pen/WNKOoPV
I am looking to change two things:
- The choropleth mapping and legend should be like this (same data used):
Another issue is that, the map polygons have a blue border around all of them. Any way to remove the blue border?
Hi @bariscope here's a slimmed down codepen to illustrate: https://codepen.io/timwis/pen/zYLzZaQ?editors=1011
It doesn't exactly match your image, but it's closer. Do you know the algorithm used to generate the buckets/breaks in the image? The default in leaflet-choropleth is quantile (q), but there's also equidistant, logarithmic, and k-means (see chroma docs). Just swap the 'q'
in mode
when you initialise your choropleth. Between that and the step count, it should hopefully get you there. Also note that the darkest value in that image is not orange but something more like #8b3e38
.
Hope this helps!