-
Notifications
You must be signed in to change notification settings - Fork 3
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
Speed up region labels interaction and fix placement during zoom #317
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The region label displayed when hovering over a region is offset from the mouse position in data coordinates, which can give inconsistent distances depending on the image size or amount of zooming. To offset by a consistent distance, transform the data coordinates to axes coordinates and offset by a fixed axes unit value. Store this offset as a private attribute for future customizability.
Move into separate function for modularity and readability.
…data The region label position changes orientation around the mouse pointer to maximize available space. The orientation has been based on data coordinates, which works when the full image is shown in the plot but not for zoomed plots, where the data midline usually differs from the plot midline. Change this midline to use the axes coordinates rather than the data coordinates.
Accept additional arguments to fix error in figure close handler.
…mance Add a blit controller class inspired by this tutorial: https://matplotlib.org/stable/tutorials/advanced/blitting.html#class-based-example Store this controller in the Plot Editor to update the region label more efficiently if the controller is set.
- Separate out appending artists into a separate function to allow appending a single arist - Add the region label from the Plot Editor to this blitter when generating the label
Implement the blitter in these editors to improve the speed of region label display on mouse hover.
The fully integrated GUI uses a TraitsUI/Pyface/Mayavi stack with PyQt5 but is not necessary for running other parts of MM, including the individual Matplotlib-based GUI components. Move the full GUI dependencies into a separate, optional group, which allows MM to be installed as a library with a smaller dependency footprint. Include this GUI group in the `most` and `all` groups to ensure that it is still installed in the recommended pathways.
Move from Atlas Editor to the image sync mixin class since the function's attributes are all present in the mixin.
Turn off the region label when leaving each Plot Editor to prevent stale labels.
… Plot Editor The Plot Editor currently filters out movements within the same pixel to reduce performance impact. Small movements may also be desirable to filter, especially for backends where redraw events can incur a delay, such as the web and Jupyter-related backends. Add a customizable threshold to filter movements based on both time since the last movement and distance. Filter out short, fast movements, which are more likely from imprecise, "noise" movements. Instead, respond to far, slow movements, such as long-distance motion to a different region of the plot or slow movement to a more precise position. The default threshold is 0 to continue filtering only movement within the same plot pixel.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Plot Editor shows region labels on mouse hover when registered atlas labels are loaded with an image. This PR fixes several issues with label interactivity: