-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Doc]: get_figure
may return a SubFigure
#28170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
In [6]: sfig2 = sfig.subfigures()
In [7]: sfig2.get_figure()
Out[7]: <Figure size 640x480 with 1 Axes> |
This seems inconsistent and likely we haven't thought about it when subfigures were introduced. Intuitively, I'd recommend the following behavior: That would imply:
|
Hmm that seems inconsistent at least so one way or another is a bug It seems that a subfigure wants to know its parent rather than its root? Ooops sorry crosspost w above. I'd have to look at the code a bit. |
Hmmm, I fear it's not so simple. I explicitly set So I wonder if the correct course of action is to override |
It's bad enough that we have a mixture of attributes and getters, having both with slightly different semantics is even worse. I propse to
|
The above seems good to me.
|
Ah, this also make sense as to why the Strongly agree we need a version that gets the parent rather than the root. |
FWIW deprecating |
Documentation Link
https://matplotlib.org/devdocs/api/_as_gen/matplotlib.artist.Artist.get_figure.html#matplotlib.artist.Artist.get_figure
Problem
I'm not sure whether this is a documentation issue or a bug. The docstring for
get_figure
states that it returns aFigure
, which I think implies the parent figure. If our artist is on a subfigure, it will return that. Note thatSubFigure
does not inherit fromFigure
.Suggested improvement
Either
SubFigure
(and point to how you can get the parentFigure
if you want it)or
Figure
The text was updated successfully, but these errors were encountered: