-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: add warnings about get_window_extent and BboxImage #29910
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
Changes from 1 commit
File filter
Filter by extension
Conversations 8000
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,19 +329,29 @@ def get_window_extent(self, renderer=None): | |
""" | ||
Get the artist's bounding box in display space. | ||
|
||
The bounding box' width and height are nonnegative. | ||
The bounding box's width and height are non-negative. | ||
|
||
Subclasses should override for inclusion in the bounding box | ||
"tight" calculation. Default is to return an empty bounding | ||
box at 0, 0. | ||
|
||
Be careful when using this function, the results will not update | ||
if the artist window extent of the artist changes. The extent | ||
can change due to any changes in the transform stack, such as | ||
changing the Axes limits, the figure size, or the canvas used | ||
(as is done when saving a figure). This can lead to unexpected | ||
behavior where interactive figures will look fine on the screen, | ||
but will save incorrectly. | ||
.. warning :: | ||
|
||
Be careful when using this function, the results will not update if | ||
the artist window extent of the artist changes. | ||
|
||
The extent can change due to any changes in the transform stack, such | ||
as changing the Axes limits, the figure size, the canvas used (as is | ||
done when saving a figure), or the DPI. | ||
|
||
This can lead to unexpected behavior where interactive figures will | ||
look fine on the screen, but will save incorrectly. | ||
tacaswell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To get accurate results you may need to manually call | ||
`matplotlib.figure.Figure.savefig` or | ||
`matplotlib.figure.Figure.draw_without_rendering` to have Matplotlib | ||
compute the rendered size. | ||
Comment on lines
+349
to
+352
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unclear to me. I feel, we are mixing two things here an it's too short to understand:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left a comment over on #2831 for why in the case of vector backends we may need savefig (tl;dr: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still think this is too terse to be helpful and actionable for users. However, I won't block over this. Decide yourself whether it's good enough for now or how much additional effort you want to put into this. |
||
|
||
""" | ||
return Bbox([[0, 0], [0, 0]]) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.