3

In looking for answer to Matplotlib get subplot (axes) size? , I've realized that the ax1, ax2 variables there are of class AxesSubplot.

However, I cannot find any documentation on this anywhere - for instance:

https://matplotlib.org/3.1.1/search.html?q=axessubplot&check_keywords=yes&area=default

results with:

Your search did not match any documents

So, is AxesSubplot class properties and methods documented anywhere; and if not, which is the right source file to consult, to find its API?

sdbbs
  • 4,270
  • 5
  • 32
  • 87

1 Answers1

1

An AxesSubplot is an object that is created on the fly when creating subplots in matplotlib. It hence has no documentation. But for most practical purposes it's identical to the usual Axes.

In addition it has methods of SubplotBase available.

ImportanceOfBeingErnest
  • 321,279
  • 53
  • 665
  • 712
  • Many thanks, @ImportanceOfBeingErnest - great to have this documented. That was my first guess too, but I saw the `Axes` page has `position` under "Other optional keyword arguments", and I tried to print `ax1.position`, and got `AttributeError: 'AxesSubplot' object has no attribute 'position'` - which confused me, and is the reason why I ended up asking this question. – sdbbs Nov 22 '19 at 13:54
  • 1
    Yes, if `position` is an "optional keyword argument", it means `Axes(..., position=...)` is valid. If you click on that you are directed to the method: `ax.set_position` (equally you can use `ax.get_position`). – ImportanceOfBeingErnest Nov 22 '19 at 13:57