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

Appearance settings

Fix infinite loop for connectionstyle + add some tests #11323

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

Conversation

ImportanceOfBeingErnest
Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest commented May 28, 2018

PR Summary

Fixes #11294.
A comparrisson with 0 (x == 0) is replaced by comparing with a small number (abs(x) < eps) such that numeric errors do not bypass the raising of an error for non-intersecting lines.

Related to that, commit #9519 intended to add a test for ConnectionStyles which was hindered by errors as seen in #9518. This PR adds the desired test by choosing an arrow style, which allows for all ConnectionStyles to be tested. Hence fixes #9518.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

modulo maybe using allclose instead of a fixed value?

@@ -31,8 +31,9 @@ def get_intersection(cx1, cy1, cos_t1, sin_t1,
c, d = sin_t2, -cos_t2

ad_bc = a * d - b * c
if ad_bc == 0.:
raise ValueError("Given lines do not intersect")
if np.abs(ad_bc) < 1.0e-12:
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

What's the difference between

  • np.abs(ad_bc) < 1.0e-12
  • np.isclose([0], [ad_bc], atol=1.0e-12)

Why would I prefer the longer over the shorter?

@jklymak jklymak merged commit 9163389 into matplotlib:master May 28, 2018
@ImportanceOfBeingErnest ImportanceOfBeingErnest deleted the connectionstylefix branch May 28, 2018 20:29
@QuLogic QuLogic added this to the v3.0 milestone May 28, 2018
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.

ConnectionStyle Angle3 hangs with specific parameters Some ConnectionStyle not working
4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.