Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show an AxesSubplot in Python?

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?

like image 974
user3765587 Avatar asked Oct 24 '14 02:10

user3765587


2 Answers

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

If you have imported as plt, then:

import matplotlib.pyplot as plt  # create fig1 (of type plt.figure) # create fig2  plt.show()  # will display fig1 and fig2 in different windows 
like image 118
heltonbiker Avatar answered Sep 19 '22 10:09

heltonbiker


Alternatively, you could call the figure attribute of your fig2:

fig2.figure  
like image 34
Bython Avatar answered Sep 22 '22 10:09

Bython