示例代码
import matplotlib.pyplot as plt
import numpy as np
plt.style.use(‘_mpl-gallery’)
x = np.linspace(0, 10, 100)
y = 4 + 2 * np.sin(2 * x)
fig, ax = plt.subplots()
ax.plot(x, y, linewidth=2.0)
ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
ylim=(0, 8), yticks=np.arange(1, 8))
plt.show()
执行时警告信息
MatplotlibDeprecationWarning: Support for FigureCanvases without a required_interactive_framework attribute was deprecated in Matplotlib 3.6 and will be removed two minor releases later.
fig, ax = plt.subplots()文章来源:https://www.toymoban.com/news/detail-435466.html
解决方法
import matplotlib
matplotlib.use(‘qt5agg’)文章来源地址https://www.toymoban.com/news/detail-435466.html
到了这里,关于Matplotlib Support for FigureCanvases without a required_interactive_framework的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!