8000 Update lines.py · matplotlib/matplotlib@eaa8b63 · GitHub
[go: up one dir, main page]

Skip to content

Commit eaa8b63

Browse files
authored
Update lines.py
1 parent 907a79d commit eaa8b63

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/matplotlib/lines.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,9 @@ def get_transform(self):
14991499
ax = self.axes
15001500
points_transform = self._transform - ax.transData + ax.transScale
15011501

1502+
# Initialize the manual_slope variable to False
1503+
manual_slope = False
1504+
15021505
if self._xy2 is not None:
15031506
# two points were given
15041507
(x1, y1), (x2, y2) = \
@@ -1517,15 +1520,13 @@ def get_transform(self):
15171520
# one point and a slope were given
15181521
x1, y1 = points_transform.transform(self._xy1)
15191522
slope = self._slope
1523+
# Since the slope is provided manually, set manual_slope to True
1524+
manual_slope = True
15201525
(vxlo, vylo), (vxhi, vyhi) = ax.transScale.transform(ax.viewLim)
15211526

1522-
# Adjust the tolerance for np.isclose based on the view limits
1523-
y_limits = ax.get_ylim()
1524-
tolerance = abs((y_limits[1] - y_limits[0]) / (vxhi - vxlo)) * 1e-8
1525-
15261527
# General case: find intersections with view limits in either
15271528
# direction, and draw between the middle two points.
1528-
if np.isclose(slope, 0, atol=tolerance):
1529+
if not manual_slope and (np.isclose(slope, 0, atol=1E-16)):
15291530
start = vxlo, y1
15301531
stop = vxhi, y1
15311532
elif np.isinf(slope):

0 commit comments

Comments
 (0)
0