Skip to content

Cleanup cursor_demo. #12955

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
Dec 15, 2018
Merged

Cleanup cursor_demo. #12955

merged 1 commit into from
Dec 15, 2018

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 9, 2018

  • Less pyplot, more OO.
  • Showcase both Cursor implementations.
  • Misc. cleanups.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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


Faster cursoring is possible using native GUI drawing, as in
wxcursor_demo.py.
:doc:`/gallery/user_interfaces/wxcursor_demo_sgskip`.

The mpldatacursor and mplcursors third-party packages can be used to achieve a
similar effect. See

https://github.com/joferkington/mpldatacursor
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
https://github.com/joferkington/mpldatacursor
- https://github.com/joferkington/mpldatacursor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

switched to rst anonymous link syntax


Faster cursoring is possible using native GUI drawing, as in
wxcursor_demo.py.
:doc:`/gallery/user_interfaces/wxcursor_demo_sgskip`.

The mpldatacursor and mplcursors third-party packages can be used to achieve a
similar effect. See

https://github.com/joferkington/mpldatacursor
https://github.com/anntzer/mplcursors
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
https://github.com/anntzer/mplcursors
- https://github.com/anntzer/mplcursors

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above.


Faster cursoring is possible using native GUI drawing, as in
wxcursor_demo.py.
:doc:`/gallery/user_interfaces/wxcursor_demo_sgskip`.

The mpldatacursor and mplcursors third-party packages can be used to achieve a
similar effect. See
Copy link
Member

Choose a reason for hiding this comment

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

As far as I understand, the "similar" part is not quite true. This example focusses on drawing a cross-hair (free or snapped to data). The mentioned cursor packages add an annotation. I think the meaning of "cursor" is quite different here and there and thus should be clarified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the wx example linked also does something different; the whole text could be redone. Feel free to push if you have something better.

requires redrawing the figure with every mouse move.
This example shows how to use Matplotlib to provide a data cursor. It uses
Matplotlib to draw the cursor and may be a slow since this requires redrawing
the figure with every mouse move.

Faster cursoring is possible using native GUI drawing, as in
Copy link
Member

Choose a reason for hiding this comment

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

There's also https://matplotlib.org/gallery/widgets/cursor.html which seems like a better builtin version of this example. It should at least be linked.

Given this, do we still need this example here? If so, it's probably only for educational puposes and that should be mentioned.

- Less pyplot, more OO.
- Showcase both Cursor implementations.
- Misc. cleanups.
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Incremental improvement.

@dstansby dstansby added this to the v3.1 milestone Dec 15, 2018
@dstansby dstansby merged commit 6a071fd into matplotlib:master Dec 15, 2018
@anntzer anntzer deleted the cursor_demo branch December 15, 2018 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants