Skip to content

Fix containment and subslice optim. for steps. #6645

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 2 commits into from
Jul 12, 2016

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 26, 2016

#6497 set the _path attribute of Line2D to the actually drawn path
even if the drawstyle is steps-*; however containment tests and the
subslice optimization for very long paths were not updated accordingly
(see #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 of
that point.

 matplotlib#6497 set the `_path` attribute of Line2D to the actually drawn path
even if the drawstyle is `steps-*`; however containment tests and the
subslice optimization for very long paths were not updated accordingly
(see matplotlib#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 of
that point.
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jun 29, 2016
_steps = self._path._interpolation_steps
_path = Path(self._xy[subslice, :], _interpolation_steps=_steps)
xy = STEP_LOOKUP_MAP[self._drawstyle](*self._xy[subslice, :].T)
_path = Path(np.asarray(xy).T,
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 add a test image for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Remove duplicated test as well.
@@ -4460,12 +4460,6 @@ def test_ls_ds_conflict():
linestyle='steps-pre:', drawstyle='steps-post')


@cleanup
def test_ls_ds_conflict():
Copy link
Member

Choose a reason for hiding this comment

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

why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is duplicated (see the lines just above).

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that is a good reason to remove it.

@tacaswell tacaswell merged commit 239e5f0 into matplotlib:master Jul 12, 2016
@anntzer anntzer deleted the drawstyle-index-and-subslice branch July 12, 2016 16:09
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