嗨,我有一组数据,我需要在三维绘图
为此,我使用了matplotlibs plot_surface,因为我的一些数据值很大,而大部分值很小。
i、 e最大峰值为0.7,下一个最大峰值为0.15。
所以我需要使用某种非线性颜色映射,否则小细节会完全模糊。在
所以我尝试了以下非线性颜色映射创建source:class nlcmap(object):
def __init__(self, cmap, levels):
self.cmap = cmap #original colourmap
self.N = cmap.N
self.levels = numpy.asarray(levels, dtype='float64')
self._x = self.levels
self.levmax = self.levels.max()
self._y = numpy.linspace(0.0, self.levmax, len(self.levels))
def __call__(self, xi, alpha=1.0, **kw):
yi = numpy.interp(xi, self._x, self._y)
return self.cmap(yi / self.levmax, alpha)
要为三维轮廓图创建自定义颜色图:
^{pr2}$
但我得到了一个错误:
raise ValueError(“无法识别Colormap%s”%name)
值错误:Colormap<;main无法识别0x06E81AF0