Matplotlib had the pyplot interface, and then later developed the object-oriented interface, as described in the documentation (https://matplotlib.org/3.2.1/tutorials/introductory/lifecycle.html).
The latter is now preferred, so use fig, ax = plt.subplots and then use the setter method on ax.