pycharm中MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_fram

MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later. plt.xlabel(“x”)

MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later. plt.show()

在绘图时出现错误,看网上有贴子说需要修改pycharm中搜索 Python Scientific 取消勾选 show plot tool window,但个人觉得比较麻烦,可以在绘图包导入时添加一行代码“plt.switch_backend(‘TkAgg’)”解决。

1. 添加的代码plt.switch_backend(‘TkAgg’)

#添加的代码
plt.switch_backend('TkAgg')

pycharm中MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_fram_第1张图片

2. 取消勾选 show plot tool window的过程

pycharm中MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_fram_第2张图片
第一种:
pycharm中MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_fram_第3张图片

第二种:
pycharm中MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_fram_第4张图片

你可能感兴趣的:(经验技巧,科研技巧,资料,pycharm,ide,python,matplotlib)