使用 matplotlib.colormaps 时遇到问题

Ale*_*sio 5 python matplotlib

我在使用 matplotlib 中的颜色图时遇到问题。在我写“cmap = mpl.colormaps[cmap_name]”的行中,出现错误:“AttributeError:模块'matplotlib'没有属性'colormaps'”(cmap =='Blues')。我确定我需要这样使用它,有人理解这个问题吗?

我查了一下如何使用该功能,他们的做法是一样的。

sha*_*adi 0

也许更新到 matplotlib 版本 >= 3.5

参考: https: //github.com/matplotlib/matplotlib/issues/25916#issuecomment-1554331806