7

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.

1 Answer 1

13

Did you try

fig, ax = plt.subplots()
my_dataframe.plot(ax=ax)
plt.show() # plt in place of ax
Sign up to request clarification or add additional context in comments.

1 Comment

For people not used to these abbreviations: plt referers to import matplotlib.pyplot as plt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.