If you want the stacked plot as in the second case, the subplot call needs to be 211 or 212. The first 2 digits define the rows and columns of your plot "grid". This is a matplotlib usage issue not related to Spyder.
On Friday, August 14, 2020 at 6:38:40 AM UTC-4 [email protected] wrote: > > I'm using the following code to make 2 plots, > > > > > > > > > > > > > > > > > > > > > > > > > *import numpy as npimport matplotlib.pyplot as pltx = [1, 2, 3, 4, 5]y = > [2, 4, 6, 8, 10]x1 = [1, 2, 3, 4, 5]y1 = [1, 4, 9, 14, 25]t = > np.arange(0.0, 2.0, 0.01)s1 = np.sin(2*np.pi*t)s2 = > np.sin(4*np.pi*t)plt.figure(1)plt.subplot(111)plt.plot(x, > y)plt.subplots(112)plt.plot(x1, y1)plt.figure(2)plt.subplot(211)plt.plot(t, > s1)plt.subplot(212)plt.plot(t, 2*s1)plt.show()* > > The first plot is fine but the second plot gets messed up, > > [image: messedUpPlotSpyder.png] > > But when I comment out the code for the 1st plot it plots as exected, > > [image: notMessedUpPlotSpyder.png] > -- You received this message because you are subscribed to the Google Groups "spyder" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/spyderlib/72f92eca-ec31-41cc-8909-fb8a5abbf27cn%40googlegroups.com.
