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

Line2D._path obeys drawstyle.#6497

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

Conversation

anntzer
Copy link
Contributor

For stepping drawstyles,Line2D.draw used to recompute a path at drawing time, because its_path attribute always assumed a linear drawstyle. Instead, directly compute the correct path.

Alsofixes#6447 (Line2D.contains did not take drawstyle into account) because that code relied on proximity of the mouse event with the underlying path.

Note that unfortunately, the drawstyle names remain inconsistent with those accepted byfill_between andfill_betweenx, which (seem to be the only functions to) rely oncbook.STEP_LOOKUP_MAP. It may be a good opportunity to fix the discrepancy too...

For stepping drawstyles, `Line2D.draw` used to recompute a path atdrawing time, because its `_path` attribute always assumed a lineardrawstyle.  Instead, directly compute the correct path.Alsofixesmatplotlib#6447 (`Line2D.contains` did not take drawstyle into account)because that code relied on proximity of the mouse event with theunderlying path.
@tacaswelltacaswell added this to the2.1 (next point release) milestoneMay 29, 2016
drawStyles = {}
drawStyles.update(_drawStyles_l)
drawStyles.update(_drawStyles_s)
# Need a list ordered with long names first:
drawStyleKeys = (list(six.iterkeys(_drawStyles_l)) +
list(six.iterkeys(_drawStyles_s)))

_drawstyle_conv = {
'default': lambda x, y: (x, y),
'steps': pts_to_prestep,
Copy link
Member

Choose a reason for hiding this comment

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

Can you just add these two toSTEP_LOOKUP_MAP and correct the spelling ofstep-pre and friends tosteps-*? I suspect I meant to do the refactor you are doing now as part of the work where thefill_between feature got added, but ran out of steam (it was one of the last things to get merged before 1.5.0 iirc).

@tacaswell
Copy link
Member

What the input tofill_between andfill_betweenx is matching is the input toax.step (see#4433).

I would keep thedraw_style values as locked down as possible, but letwhere (in step) andstep (infill_between take the version both with and withoutsteps).

@anntzer
Copy link
ContributorAuthor

Like in this version?

'post': pts_to_poststep,
'mid': pts_to_midstep,
'step-pre': pts_to_prestep,
'step-post': pts_to_poststep,
'step-mid': pts_to_midstep}
'step-mid': pts_to_midstep,
Copy link
Member

Choose a reason for hiding this comment

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

I would remove thestep-* entries. They are not documented and this is the only place those strings appear in the code base. I am 98% sure the lack of 's' here was my mistake.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@anntzeranntzerforce-pushed thefix-line2d-contains-drawstyle branch fromdb60992 tob8fe72cCompareMay 29, 2016 21:56
@tacaswell
Copy link
Member

👍 Will merge once CI finishes.

@tacaswelltacaswell merged commita260058 intomatplotlib:masterMay 29, 2016
@anntzeranntzer deleted the fix-line2d-contains-drawstyle branchMay 29, 2016 23:30
anntzer added a commit to anntzer/matplotlib that referenced this pull requestJun 26, 2016
matplotlib#6497 set the `_path` attribute of Line2D to the actually drawn patheven if the drawstyle is `steps-*`; however containment tests and thesubslice optimization for very long paths were not updated accordingly(seematplotlib#6615).  This patch fixes the issues.Note that `contains` returns, for events in a horizontal segment of a"steps-mid" drawstyle plot, the index of the point in the segment,regardless of whether the event occured to the left or the right ofthat point.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

Line2D.contains does not take drawstyle into account.
3 participants
@anntzer@tacaswell@mdboom

[8]ページ先頭

©2009-2025 Movatter.jp