Traceback (most recent call last): File "C:/Users/86156/Desktop/.2.py", line 24, in <module> plt.imshow (I,norm=[0,0.5],interpolation='bicubic',vmin=0,vmax=1/2)#强度图 File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 2695, in imshow __ret = gca().imshow( File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 1459, in inner return func(ax, *map(sanitize_sequence, args), **kwargs) File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\axes\_axes.py", line 5658, in imshow im = mimage.AxesImage(self, cmap=cmap, norm=norm, File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\_api\deprecation.py", line 454, in wrapper return func(*args, **kwargs) File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\image.py", line 922, in __init__ super().__init__( File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\image.py", line 260, in __init__ cm.ScalarMappable.__init__(self, norm, cmap) File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\cm.py", line 398, in __init__ self.set_norm(norm) # The Normalize instance of this ScalarMappable. File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\cm.py", line 636, in set_norm self.norm = norm File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\cm.py", line 595, in norm _api.check_isinstance((colors.Normalize, str, None), norm=norm) File "C:\Users\86156\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\_api\__init__.py", line 93, in check_isinstance raise TypeError( TypeError: 'norm' must be an instance of matplotlib.colors.Normalize, str or None, not a list
时间: 2023-06-07 09:11:33 浏览: 104
浅谈Python traceback的优雅处理
这个错误信息提示最近的调用是在C:/Users/86156/Desktop/.2.py的第24行,plt.imshow函数出现了问题,可能是由于norm参数的值不正确引起的。此外,还设置了interpolation、vmin和vmax等参数。
阅读全文