0

matplotlib newbie here, I'm making temperature plots for 4 different locations, I managed to plot them individually with the following code:

import matplotlib.pyplot as plt

fig, ax1 = plt.subplots(1, 1, sharex=True)
ax1.fill_between([i for i in range(1,367)], min_temp, max_temp, color='orange',alpha=0.3)
plt.plot(mean_temp, 'r',)
plt.ylabel('Temperature ($^\circ$C)')
plt.xlabel('Julian day')
plt.title('Location A')
plt.xlim(1, 366)

the code yields this plot

I would like to plot a grid with dimensions 2x2, which I usually know how to do, with plt.subplot(), however, due to the fact that I already used plt.subplots() on the line above this is making me very confused on how to proceed

RodX
  • 25
  • 6
  • 1
    But ... you're not using `plt.fill_between`, rather [`Axes.fill_between`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.fill_between.html). You could try reading [here](https://matplotlib.org/stable/tutorials/introductory/lifecycle.html) about the object-oriented interface. In other words, `fig, axs = plt.subplots(2, 2)`, then `axs[0, 0].fill_between`, `axs[0, 1].fill_between` and so on. – BigBen Jun 29 '21 at 19:06
  • thank you, I'll try, like I said, I'm pretty much new to plotting with python, I'm just making up as I go – RodX Jun 29 '21 at 19:13

0 Answers0