Skip to content

Lasso selector - #730

Merged
efiring merged 13 commits into
matplotlib:masterfrom
tonysyu:lasso-selector
Mar 17, 2012
Merged

efiring merged 13 commits into
matplotlib:masterfrom
tonysyu:lasso-selector

Conversation

@tonysyu

@tonysyu tonysyu commented Mar 1, 2012

Copy link
Copy Markdown
Contributor

Add LassoSelector widget that behaves more like RectangleSelector and SpanSelector than the current Lasso widget.

Note: I put the demo in the "widgets" directory even though the Lasso demo is in "event_handling".

Also, note that this PR builds off of PR #724: Only the last commit in this PR adds the new widget.

* This change is in preparation for generalizing the base Widget.
* It's not clear to me why `new_axes` is necessary, but I left it in (for now).
* Renamed `Lasso.axes` to `Lasso.ax` for consistency.
* Remove `Lasso.figure`, which was unused.
* Attribute name "active" can be confused with parameter to `RadioButtons`, but `RadioButtons` doesn't save that parameter as an attribute, so there's no name clash. BUT this is still really confusing to users. Consider renaming `AxesWidget.active`.
*
* * This could have been implemented as a decorator, but some callbacks wouldn't be compatible. For example, `SpanSelector.release` should not be ignored if widget was deactivated during mouse press.
*
* * `SpanSelector` and `RectangleSelector` already had `ignore` methods, but they do not call it in `update_background`. I don't change the current behavior, although it seems desirable.
Also, remove unused import.
Note: I put the demo in the "widgets" directory even though the `Lasso` demo is in "event_handling".
Comment thread lib/matplotlib/widgets.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this render correctly? It is certainly safer to do :class:~matplotlib.axes.Axes. (the tilde shortens the link to Axes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about this. Thanks for the tip.

Comment thread examples/widgets/lasso_selector_demo.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can't work since nxutils was removed in master... see #732 for example of how to get around that one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm on the latest master, and it works fine on my system. Am I missing something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually,... I didn't clean out my build, so I had a leftover nxutils.so. I just converted to use Path.contains_point. Thanks for the tip!

@efiring

efiring commented Mar 12, 2012

Copy link
Copy Markdown
Member

Please add docstrings for Lasso and LassoSelector.

@tonysyu

tonysyu commented Mar 12, 2012

Copy link
Copy Markdown
Contributor Author

@efiring doctstrings, done.

efiring added a commit that referenced this pull request Mar 17, 2012
@efiring
efiring merged commit adf6680 into matplotlib:master Mar 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants