8000 points_in_path can fail with NaN data by mdboom · Pull Request #3759 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

points_in_path can fail with NaN data #3759

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
Nov 7, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Minor fixes
  • Loading branch information
mdboom committed Nov 6, 2014
commit 216e9f57e87ca7d1e48f4a181bc73d814cd0be47
4 changes: 3 additions & 1 deletion lib/matplotlib/tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def test_point_in_path_nan():
box = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])
p = Path(box)
test = np.array([[np.nan, 0.5]])
assert p.contains_points(test)[0] == False
contains = p.contains_points(test)
assert len(contains) == 1
Copy link
Member

Choose a reason for hiding this comment

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

why isn't the length 2?

Copy link
Member

Choose a reason for hiding this comment

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

Because "test" is length 1

On Fri, Nov 7, 2014 at 9:05 AM, Thomas A Caswell notifications@github.com
wrote:

In lib/matplotlib/tests/test_path.py:

@@ -61,6 +61,15 @@ def test_path_clipping():
xy, facecolor='none', edgecolor='red', closed=True))

+def test_point_in_path_nan():

  • box = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])
  • p = Path(box)
  • test = np.array([[np.nan, 0.5]])
  • contains = p.contains_points(test)
  • assert len(contains) == 1

why isn't the length 2?


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3759/files#r20011300.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah -- a single point (which is an x, y pair) is being tested.

Copy link
Member

Choose a reason for hiding this comment

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

Right, sorry for the brains-bar comment.

On Fri Nov 07 2014 at 11:23:55 AM Michael Droettboom <
notifications@github.com> wrote:

In lib/matplotlib/tests/test_path.py:

@@ -61,6 +61,15 @@ def test_path_clipping():
xy, facecolor='none', edgecolor='red', closed=True))

+def test_point_in_path_nan():

  • box = np.array([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]])
  • p = Path(box)
  • test = np.array([[np.nan, 0.5]])
  • contains = p.contains_points(test)
  • assert len(contains) == 1

Yeah -- a single point (which is an x, y pair) is being tested.


Reply to this email directly or view it on GitHub
https://github.com/matplotlib/matplotlib/pull/3759/files#r20019732.

assert not contains[0]


if __name__ == '__main__':
Expand Down
0