-
Notifications
You must be signed in to change notification settings - Fork 153
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
Drawn ROIs affect legend placement in matplotlib 3.7 #2368
Comments
One solution to this problem could be to only add the patch to the axes during the ROI's |
Not quite sure if I actually agree with this. If an ROI exists when plotting, one may reasonably expect that anything inside it is of some interest (that's in the name at least ;-), so it makes sense to avoid covering that area, if possible. |
That's true, the user has selected the ROI region for some purpose. I guess it just feels odd to me to be willing to draw the legend over points rather than an area that is visually empty.
There aren't any ROIs that have been created yet, but I think the issue with the failing tests is due to the |
And that is created, I assume, with |
This was resolved with #2370 and can be closed. |
Describe the bug
With matplotlib 3.7 (in particular the updates from matplotlib/matplotlib#9598), ROIs drawn with selection tools now affect the placement of the legend on the graph when using the "draggable" (default) or "best" legend location options. The reason for this is that the path of non-rectangular patches is now used when determining the best option. This means that the
Patch
objects drawn during ROI selection affect the legend placement (even though they aren't visible). Note that some of the patches have an initial size (e.g. the patch forMplPolygonalROI
has initial vertices [0, 0] and [1, 1]) which can cause this issue to manifest before any selections are made, depending on the viewer bounds.To Reproduce
Steps to reproduce the behavior such as:
Expected behavior
Selection ROIs shouldn't affect legend placement.
Screenshots
Here's an example screenshot. Matplotlib prefers the center-right placement of the legend, which overlaps a visible data point, over the open top-right area, because I had made a selection with a rectangular ROI there.
Details:
python --version
): 3.10.9glue --version
): 1.7.0Additional context
Note that this is the cause of four of the five current CI failures (see #2366 for a resolution to the other one). The discrepancy in the tests occurs because the patches aren't included in the export script.
The text was updated successfully, but these errors were encountered: