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

Commit c236102

Browse files
Fix: Do not use numeric tolerances for axline special cases (matplotlib#28987)
vertical lines (infinite slope) and two identical points as input need special handling in AxLine. The detection was using numeric tolerances, which lead to false-positive detection in cases that are close to but not exactly those special cases. This PR removes the tolerances. The argument is the same as for the similar case matplotlib#28386 (comment) Closes matplotlib#28870.
1 parent eb812a8 commit c236102

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎lib/matplotlib/lines.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,8 +1506,8 @@ def get_transform(self):
15061506
points_transform.transform([self._xy1, self._xy2])
15071507
dx = x2 - x1
15081508
dy = y2 - y1
1509-
if np.allclose(x1, x2):
1510-
if np.allclose(y1, y2):
1509+
if dx==0:
1510+
if dy==0:
15111511
raise ValueError(
15121512
f"Cannot draw a line through two identical points "
15131513
f"(x={(x1, x2)}, y={(y1, y2)})")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /