如何在Python中显示AxesSubplot? [英] How to show an AxesSubplot in Python?

查看:79
本文介绍了如何在Python中显示AxesSubplot?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an object fig2 that is a class mathplotlib.axes.axessubplot, but when I try to execute fig2.show(), python says axessubplot object has no attribute show. How can I show AxesSubplot?

推荐答案

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

You should call matplotlib.pyplot.show(), which is a method that displays all the figures.

如果您已导入为 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中显示AxesSubplot?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆