python - 如何在 Python 中显示 AxesSubplot?

标签 python matplotlib

我有一个对象 fig2,它是一个类 mathplotlib.axes.axessubplot,但是当我尝试执行 fig2.show() 时,python 说 axessubplot 对象没有属性显示。如何显示 AxesSubplot?

最佳答案

你应该调用matplotlib.pyplot.show(),这是一个显示所有图形的方法。

如果你已经导入为plt,那么:

import matplotlib.pyplot as plt

# create fig1 (of type plt.figure)
# create fig2

plt.show()  # will display fig1 and fig2 in different windows

关于python - 如何在 Python 中显示 AxesSubplot?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26540567/

相关文章:

python - matplotlib pyplot.plot() : How do you plot data as a line when the data contains a single value surrounded by masks?

pandas - 如何使用 pandas 绘制年度数据集?

python - 在 Enthought Canopy IDE 中执行脚本时 matplotlib.figure() 不起作用

python - ipython事后调试: scope of outer function

python matplotlib : mark dots over Line2D

python - Pygame轨道模拟问题

python - 交换存储在元组中的两个列表的位置

python - Matplotlib 中绘制的点之间的连接线

python - 当值相同时如何组合字典的键?

python - 列出多态继承选择并根据该选择创建实例