matplotlib figure vs subplot vs axes?

Viewed 2744

Though I've been able to create basic plots with matplotlib.pyplot before, I cannot fully understand what the difference between these are:

  • figure
  • subplot
  • axes
  • (axis?)

As I understand, all three of these are objects for the area in which a graph is drawn, so what distinguishes them in terms of what can be drawn inside them?

2 Answers

The components are hierarchical:

Figure object: the whole figure

Axes object: belongs to a Figure object and is the space where we add the data to visualize

Axis object: belongs to an Axes object. Axis object can be categorized as XAxis or YAxis.

For further info, visit this link:

Getting Started with Matplotlib

Related