5

I'm drawing colored regions on a folium map using log scale shading. Using custom colormap, the region colors seem to be ok. But the colormap, when added to the map legend, still looks linear:

Still linear in the Leaflet map legend

Is there any way to draw it as equal-width colored rectangles with text values underneath?

import numpy as np, branca, folium
m = folium.Map()
colormap = branca.colormap.LinearColormap(colors=['blue', 'green', 'yellow', 'orange', 'red'],
                                          index = np.round(np.exp(np.linspace(0, 9, 5))),
                                          vmin = 0, vmax = np.exp(9),
           ).to_step(n=6, index=np.round(np.exp(np.linspace(0, 9, 6))))
colormap.add_to(m)
sentence
  • 8,213
  • 4
  • 31
  • 40
Alexander Pavlov
  • 665
  • 6
  • 14

0 Answers0