简体   繁体   中英

Does matplotlib axes know which figure it is in?

Can I use something like

ax.get_figure()

to get the figure which the ax is in.

yes, Axes need to know what figure they are is for the transform stack to work properly. To get at this information, Axes object have an attribute:

fig = ax.figure

which is the figure the axes is in. As a side note, you can not easily move axes between figures or artists between axes for exactly this reason.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM