在matplotlib中添加颜色栏时发生AttributeError

在matplotlib中添加颜色栏时发生AttributeError,第1张

在matplotlib中添加颜色栏时发生AttributeError

注意:我正在使用python 2.6.2。您的代码引发了相同的错误,以下修改解决了该问题。

我阅读了以下颜色栏示例:http
:
//matplotlib.sourceforge.net/examples/pylab_examples/colorbar_tick_labelling_demo.html

from matplotlib import pylab as plimport numpy as npdata = np.random.rand(6,6)fig = pl.figure(1)fig.clf()ax = fig.add_subplot(1,1,1)img = ax.imshow(data, interpolation='nearest', vmin=0.5, vmax=0.99)fig.colorbar(img)pl.show()

不知道为什么您的示例不起作用。我对matplotlib不太熟悉。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5644788.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存