我想用特定的值范围自定义颜色栏(colormap)。颜色范围应随给定参数(Tup、Tmd、Tbt)而变化,其中
中间颜色(石灰色)的范围应通过用户选择的Tup和Tbt,Tmd作为中间点
我试图使用下面的代码片段生成自定义颜色映射,但无法使用用户提供的值控制其范围
cmap = LinearSegmentedColormap.from_list("", ["blue","gray","lime","gray","red"])
cax = ax.pcolor(data,cmap=cmap,edgecolors='k',vmin=0,vmax=100)
如何根据用户输入控制颜色映射值
您可以使用^{} 的组合来创建颜色贴图,使用^{} 来定义端点和中心点
演示(代码未优化,但它显示了总体思路):
相关问题 更多 >
编程相关推荐