-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Changes widgets/Cursor: #5952
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
Changes widgets/Cursor: #5952
Conversation
(1) added option so that a right click enables dragging of cursors (2) Changed behavior so cursor starts in the center of the window. (3) Added method self.coord() that returns the coordinates of the cursor. (4) When cursor leaves the axis containing the cursor, the cursor is left at its final position rather than being erased. These changes are designed to make this cursor useful for selecting some point on the figure. Added class Cursors: Similar to Cursor, but many cursors.
This sounds very useful. Does this work clash with #5786 ? |
It seems that #5786 is a pretty comprehensive set of graph interaction tools with more broad impact than my simple change + extension to the existing cursor functionality. It is possible that this should be merged into the proposed set of interactive drawing classes, but in my view this simply fleshes out the functionality of the existing Cursor class. |
Note: added commit to my branch cleaning up PEP8 stuff that may or may not have lead to the failure of the Travis CI build. |
It looks like the |
visible=False, | ||
**prop) | ||
|
||
self.__selected = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only need one of this or L1162
Can you restore the old behavior that if the hit is not in the axes to hide the cursor in non-draggable mode? |
|
||
for prop, new_prop in zip(properties, self.properties): | ||
new_prop['visible'] = True | ||
new_prop['horizOn'] = prop.pop('horizOn', True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are going to pop, make a copy first. Keeping functions pure is a general a good thing. The use case this supports is passing the same list of properties to several Cursors
each on a different axes.
This also needs an entry in https://github.com/matplotlib/matplotlib/tree/master/doc/users/whats_new |
|
||
The following code will add three cursors to an existing axis | ||
|
||
csr = Cursors(ax, [{'color':'red'}, {'color':'blue'}, {'color':'black'}], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you format this as a rst code section so that the docs render nicely?
Over all 👍 |
I also threw a PR at your branch fixing a bunch of pep8 issues (sorry, couldn't help my self when I was reading the code...) |
Please do not merge the master branch into your feature branch. If there are no conflicts do not worry about it and if there are conflicts please rebase. |
I'll close this as orphaned.... |
(1) added option so that a left click enables dragging of cursors
(2) Changed behavior so cursor starts in the center of the window.
(3) Added method self.coord() that returns the coordinates of the cursor.
(4) When cursor leaves the axis containing the cursor, the cursor is left at its final position rather than being erased.
These changes are designed to make this cursor useful for selecting some point on the graph. We use this type of behavior all the time is our current data analysis workflow in Igor pro (for example, you might use a cursor to select the location of a peak in a data trace to define where to start a fit).
Added class Cursors:
Similar to Cursor, but many cursors.