TypeError: set_ticks() got an unexpected keyword argument 'labels'

TypeError: set_ticks() got an unexpected keyword argument 'labels'

我正在尝试 运行 来自的热图示例:https://matplotlib.org/stable/gallery/images_contours_and_fields/image_annotated_heatmap.html

当我在 Anaconda3 环境中 运行 编译 PyCharm(专业版)中的代码时,会出现错误消息。

TypeError: set_ticks() got an unexpected keyword argument 'labels'

如果您使用的是 matplotlib 3.4.3 版本,则无需更新 matplotlib 版本。

这是 matplotlib 3.4.3 documentation 的 link 并避免在 ax.set_xticks() 函数中使用 labels 关键字,如 JohnC

所说