python - folium 地图中的非线性颜色图
问题描述
我正在folium
使用对数比例阴影在地图上绘制彩色区域。使用自定义颜色图,区域颜色似乎没问题。但是,当添加到地图图例中时,颜色图仍然看起来是线性的:
有没有办法将它绘制为等宽的彩色矩形,下面有文本值?
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)
解决方案
推荐阅读
- python - 如何为线性回归重塑数据
- python-3.x - Python:在 Google Colab 中使用 Selenium 自动将数据输入到 Google Drive
- java - Apache NIFI 自定义处理器给出错误“找不到合适的驱动程序”
- python - 从python的fasta文件之间找到主题
- hybris - 当我在 Hybris 中本地化枚举类型时,如何解决 java.lang.IllegalStateException?
- python - 解码ASCII时,是否应该故意省略奇偶校验位?
- class - UML 类图中信号的正确设计是什么?
- xcode - UICollectionView 的单元格中的按钮不起作用
- python - tkinter 文本插入 wordstart 的问题
- php - 创建自定义用户电子邮件