Closed
Description
Documentation Link
Problem
I'm not sure whether this is a documentation issue or a bug. The docstring for get_figure
states that it returns a Figure
, which I think implies the parent figure. If our artist is on a subfigure, it will return that. Note that SubFigure
does not inherit from Figure
.
In [1]: import matplotlib.pyplot as plt
In [2]: fig = plt.figure()
In [3]: sfig = fig.subfigures()
In [4]: ax = sfig.subplots()
In [5]: ax.get_figure()
Out[5]: <matplotlib.figure.SubFigure at 0x7dc0ddf4a870>
Suggested improvement
Either
- modify the docstring to clarify you might get the
SubFigure
(and point to how you can get the parentFigure
if you want it)
or - fix the method so it returns the parent
Figure