Python Forum

Full Version: matplotlib.pyplot functions create new figures instead of applying to the current one
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm starting to learn matplotlib, following the pyplot tutorial, but something weird—I think—is happening in the very first part.

When I do this,

import matplotlib.pyplot as plt
plt.plot([1, 2, 3, 4])
plt.ylabel('some numbers')
plt.show()
plt.plot([1, 2, 3, 4]) creates the figure, but plt.ylabel('some numbers') creates another figure with the label but with no plot. Nothing about this is mentioned in the tutorial, and I have been reading about the plt functions to see if this is supposed to happen and/or how to fix it, but can't find anything. What can I do about this?

I just installed matplotlib 3.1.3 and I'm running Python 3.7.6 on Spyder 4.0.1

I see that, in this version of Spyder, I don't need to use plt.show(), because all figures are shown in the 'Plots' pane.

Thanks in advance.
i have also problem drawing a plot from a csv file on jupyter notebook....how can i do it?
(Jul-09-2020, 08:13 AM)Monira Wrote: [ -> ]i have also problem drawing a plot from a csv file on jupyter notebook....how can i do it?

Please create a new thread with your issue.