Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show a Pandas plot from a script

I have a script (not an IPython notebook) that produces a plot at the end (via a pandas DataFrame). My problem is that such a plot is not showing.

Inspired by this I have tried

fig, ax = plt.subplots()
my_dataframe.plot(ax=ax)
ax.show()

which does not work. The only way I can show my plot is:

plt.figure()
my_dataframe.plot()
plt.show()

but this brings up also a empty figure that I don't want to have.

like image 479
meto Avatar asked Nov 15 '15 02:11

meto


1 Answers

Did you try

fig, ax = plt.subplots()
my_dataframe.plot(ax=ax)
plt.show() # plt in place of ax
like image 66
furas Avatar answered Oct 22 '22 00:10

furas