-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Make it possible to initialize and update regions based on interactive Matplotlib widgets #317
Conversation
Sounds like a great approach. I very much like the mpl upstream push too, though that is likely to slow adoption as mpl had historically been one of the slower packages to update. |
@astrofrog, that looks great. How would ellipses be drawn? If we add rotation, we'll also need a way to do that with the cursor (the usual API is to select and drag box corners). For ellipses, I assume there would be something to select on the major (and minor) axes? |
0d954b5
to
d40b8f4
Compare
@larrybradley - the ellipse selector is very similar (just added): For rotation, as in some other programs, I would envision pressing a modifier key and selecting any of the anchors and dragging it around. Or we could make one of the corners be a rotation one. |
…e Matplotlib widgets
d1e72a7
to
fca59b3
Compare
774de4a
to
47ec36c
Compare
Codecov Report
@@ Coverage Diff @@
## master #317 +/- ##
==========================================
+ Coverage 92.80% 92.94% +0.13%
==========================================
Files 32 32
Lines 2420 2468 +48
==========================================
+ Hits 2246 2294 +48
Misses 174 174
Continue to review full report at Codecov.
|
I’m chasing down the remaining CI failures |
@keflavich @larrybradley - this is now ready for review! |
lgtm! awesome! It deserves some documentation, but this is great! (I reviewed, saw nothing that needed change, and I verified that the selector works as expected in a test session) |
This is a proof of concept of initializing and updating regions based on interactive Matplotlib widgets (which are now a think in
matplotlib.widgets
). The idea is that regions could have aas_mpl_selector
method that takes the axes and returns a Matplotlib selector. The selector is then active and the region is updated as the selector is moved around and adjusted (providedsync
is set toTrue
, which is the default). Here's an example in action:The Matplotlib widgets included in Matplotlib don't (yet) have everything we need, in particular they don't have the ability to support rotation. However, I'm going to investigate whether the Matplotlib developers would be happy to have this additional functionality. Also moving regions around is a bit obnoxious as it requires clicking on the center of the region. I'm going to see if I can patch it to allow the whole region to be clicked and dragged. But in any case, we can either improve the widgets in Matplotlib or fork it here if they won't accept improvements upstream (which I doubt).
@keflavich @larrybradley - what do you think about this approach and API?
TODOs if we agree on the approach: