0

I have a code that prints four figures. I want to plot them into 2*2 surface(see example below) But the code is really complicated. I could not managed to do that with known subplots methods. That's why i thought it works if i assaign variables to figures and design subplot in the end

Here is the code that gives the design i want to :

plt.subplot(2, 2, 1)
plt.plot()#Figure 1
plt.subplot(2, 2, 2)
plt.plot()#Figure 2
plt.subplot(2, 2, 3)
plt.plot()#Figure 3
plt.subplot(2, 2, 4)
plt.plot()#Figure 4

Example image of the subplots i want: enter image description here

  • You normally do `fig, ((ax1, ax2), (ax3, ax4))= plt.subplots(nrows=2, ncols=2)` and then use these axes to draw on. `plt.subplot` (without "s") is the old "functional interface". See e.g. [matplotlib Axes.plot() vs pyplot.plot()](https://stackoverflow.com/questions/43482191/matplotlib-axes-plot-vs-pyplot-plot). You need to call `plt.subplots()` just before you start drawing. – JohanC Dec 28 '20 at 02:55
  • it did not work – Katharina Smith Dec 28 '20 at 16:02
  • *"**It** did not work"* isn't very informative. Please study posts like [Pyplot vs Object Oriented Interface](https://matplotlib.org/matplotblog/posts/pyplot-vs-object-oriented-interface/) and [these tutorials](https://matplotlib.org/3.3.3/tutorials/index.html) to get a better insight into matplotlib's way of working. – JohanC Dec 28 '20 at 16:46

0 Answers0