tive plots and simple cases of programmatic plot generation:: import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 5, 0.1) y = np.sin(x) plt.plot(x, y) The explicit object-oriented API is recommended for complex plots, though pyplot is still usually used to create the figure and often the axes in the figure. See `.pyplot.figure`, `.pyplot.subplots`, and `.pyplot.subplot_mosaic` to create figures, and :doc:`Axes API ` for the plotting methods on an Axes:: import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 5, 0.1) y = np.sin(x) fig, ax = plt.subplots() ax.plot(x, y) See :ref:`api_interfaces` for an explanation of the tradeoffs between the implicit and explicit interfaces. é