: 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.bar(labels, data) /Users/maojimin/PycharmProjects/pythonProject1/实习/作业/6.11.py:24: 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() /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py:68: UserWarning: Glyph 27743 (\N{CJK UNIFIED IDEOGRAPH-6C5F}) missing from current font. FigureCanvasAgg.draw(self) /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py:68: UserWarning: Glyph 33487 (\N{CJK UNIFIED IDEOGRAPH-82CF}) missing from current font. FigureCanvasAgg.draw(self) /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py:68: UserWarning: Glyph 19978 (\N{CJK UNIFIED IDEOGRAPH-4E0A}) missing from current font. FigureCanvasAgg.draw(self)
时间: 2024-01-03 17:04:01 浏览: 187
NX二次开发UF-ATTR-get-user-attribute-with-title-and-type 函数介绍
这个警告是由于Matplotlib 3.6版本中,FigureCanvas需要有required_interactive_framework属性,否则会发出警告。这个属性在Matplotlib 3.8版本中将会成为必需的属性,如果没有设置,则会引发异常。
而“Glyph missing”警告则是因为所绘制的图形中包含了当前字体不支持的字符导致的。可以尝试更换字体或者忽略这个警告。
解决这些警告的方法是升级Matplotlib到最新版本,或者忽略这个警告。如果你想升级Matplotlib,可以在终端执行以下命令:
```
pip install --upgrade matplotlib
```
如果你想忽略这个警告,可以在代码开头加入以下代码:
```python
import warnings
warnings.filterwarnings("ignore", message="Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later.")
warnings.filterwarnings("ignore", message="Glyph .* missing from current font.")
```
这样就可以忽略这两个警告了。当然,为了避免出现其他问题,建议还是尽量升级Matplotlib到最新版本。
阅读全文