API Reference#

Matplotlib interfaces#

Matplotlib has two interfaces. SeeMatplotlib Application Interfaces (APIs) for a more detaileddescription of both and their recommended use cases.

Axes interface (object-based, explicit)

create aFigure and one or moreAxes objects, thenexplicitly usemethods on these objects to add data, configure limits, set labels etc.

API:

  • subplots: create Figure and Axes

  • axes: add data, limits, labels etc.

  • Figure: for figure-level methods

Example:

fig,ax=plt.subplots()ax.plot(x,y)ax.set_title("Sample plot")plt.show()

pyplot interface (function-based, implicit)

consists of functions in thepyplot module. Figure and Axes are manipulatedthrough these functions and are onlyimplicitly present in the background.

Example:

plt.plot(x,y)plt.title("Sample plot")plt.show()

Modules#

Alphabetical list of modules: