Skip to content

Commit b49c35b

Browse files
committed
BUG: set correct xlims for lines (pandas-dev#11471, pandas-dev#11310)
* Do not assume that xdata is sorted. * Use numpy.nanmin() and numpy.nanmax() instead.
1 parent 1fbf238 commit b49c35b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/plotting/_tools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ def _get_xlim(lines):
362362
left, right = np.inf, -np.inf
363363
for l in lines:
364364
x = l.get_xdata(orig=False)
365-
left = min(x[0], left)
366-
right = max(x[-1], right)
365+
left = min(np.nanmin(x), left)
366+
right = max(np.nanmax(x), right)
367367
return left, right
368368

369369

0 commit comments

Comments
 (0)