Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix stay_span to reset onclick in SpanSelector. #10107

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

Merged
merged 1 commit into from
Mar 6, 2018
Merged

Fix stay_span to reset onclick in SpanSelector. #10107

merged 1 commit into from
Mar 6, 2018

Conversation

lkjell
Copy link
Contributor

@lkjell lkjell commented Dec 27, 2017

PR Summary

SpanSelector with the option span_stay will leave the span on the plot. However, when a button is pressed without moving the min max value is equal but the span stays the same. This PR reset the span coordinates in onpress event.

from pylab import *
from matplotlib.widgets import SpanSelector

x = arange(100)/(99.0)
y = sin(x)
fig = figure
ax = subplot(111)
ax.plot(x,y)

span = SpanSelector(ax, print, useblit=True,
                    direction="horizontal", span_stays=True)
show()

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v2.2 milestone Jan 2, 2018
@jklymak jklymak modified the milestones: needs sorting, v3.0 Mar 6, 2018
@jklymak
Copy link
Member

jklymak commented Mar 6, 2018

Sorry, I'm not getting this PR. I tried the above code without applying the patch and it seems to work. i.e. if I can make a new span by clicking and dragging. Did you want any mouse click to kill the span?

@lkjell
Copy link
Contributor Author

lkjell commented Mar 6, 2018

@jklymak yes you want the span to get destroyed when you do not drag. Another problem is when you have a visible span stayed and you only pressed, the return value is not consistent with what is shown on the screen.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Wokrs as described

@jklymak jklymak merged commit 5e22976 into matplotlib:master Mar 6, 2018
@jklymak
Copy link
Member

jklymak commented Mar 6, 2018

Thanks @lkjell !

@lkjell lkjell deleted the fix_selector_widget_stay_span branch March 6, 2018 01:03
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.