Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Update event handling docs.#19022

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
timhoffm merged 1 commit intomatplotlib:masterfromanntzer:eh
Nov 27, 2020
Merged

Update event handling docs.#19022

timhoffm merged 1 commit intomatplotlib:masterfromanntzer:eh
Nov 27, 2020

Conversation

anntzer
Copy link
Contributor

Much reformatting.

Remove documentation forpicker=<float> which is deprecated in favor
ofpickradius.

Add reference to default keymaps (closes#11472).

Modernize examples: usepickradius, usesubplots() instead of
add_subplot(111), etc.

PR Summary

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link
Member

@timhoffmtimhoffm left a comment
edited
Loading

Choose a reason for hiding this comment

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

On a general note (not part of this PR): Should this be a tutorial?


``button``
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events)
thebutton pressed: None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events)
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
the button pressed: None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events)
the button pressed: None or `.MouseButton`

@@ -162,12 +148,12 @@ Draggable rectangle exercise
----------------------------

Write draggable rectangle class that is initialized with a
:class:`~matplotlib.patches.Rectangle` instance but will move its x,y
`.Rectangle` instance but will move its x,y
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
`.Rectangle` instance but will move itsx,y
`.Rectangle` instance but will move its``xy``

print('event contains', self.rect.xy)
x0, y0 = self.rect.xy
self.press = x0, y0, event.xdata, event.ydata
self.press = self.rect.xy, event.xdata, event.ydata
Copy link
Member

Choose a reason for hiding this comment

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

This would be(x0, y0), event.xdata, event.ydata. Is this change intentional?

Edit: Seems like. But then I'd go forself.rect.xy, (event.xdata, event.ydata) so that below you have(x0, y0), (xpress, ypress) = self.press. Using a tuple only for one of the coordinates would be a bit awkward.

print('event contains', self.rect.xy)
x0, y0 = self.rect.xy
self.press = x0, y0, event.xdata, event.ydata
self.press = self.rect.xy, event.xdata, event.ydata
Copy link
Member

Choose a reason for hiding this comment

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

See above.

become additional attributes on the `.PickEvent`.

The artist's ``pickradius`` property can additionally be set to a tolerance
value (in points; there are 72 points per inch) that determines how far the
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
value(in points;there are 72 points per inch) that determines how far the
value in points (there are 72 points per inch) that determines how far the

IMHO the unit is first-class information that should not be parenthesed.

If you think that's too ambiguous, use e.g.tolerance value in units of points

ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
transform=ax.transAxes, va='top')
ax.text(0.05, 0.9,
'mu=%1.3f\nsigma=%1.3f' % (xs[dataind], ys[dataind]),
Copy link
Member

Choose a reason for hiding this comment

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

Fancy using TeX?

Suggested change
'mu=%1.3f\nsigma=%1.3f' % (xs[dataind],ys[dataind]),
f'$\mu$={xs[dataind]:1.3f}\n$\sigma$={ys[dataind]:1.3f}',

Much reformatting.Remove documentation for `picker=<float>` which is deprecated in favorof `pickradius`.Add reference to default keymaps.Modernize examples: use `pickradius`, use `subplots()` instead of`add_subplot(111)`, etc.
@anntzer
Copy link
ContributorAuthor

yes to all (except for turning into a tutorial, which can be done separately)

@timhoffmtimhoffm added this to thev3.4.0 milestoneNov 27, 2020
@timhoffmtimhoffm merged commit329da86 intomatplotlib:masterNov 27, 2020
@anntzeranntzer deleted the eh branchNovember 28, 2020 11:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.4.0
Development

Successfully merging this pull request may close these issues.

Mention predefined keyboard shortcuts in the docs on event-handling
2 participants
@anntzer@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp