Skip to content

Commit 603b5f1

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 6a9eb51 commit 603b5f1

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
@@ -361,8 +361,8 @@ def _get_xlim(lines):
361361
left, right = np.inf, -np.inf
362362
for l in lines:
363363
x = l.get_xdata(orig=False)
364-
left = min(x[0], left)
365-
right = max(x[-1], right)
364+
left = min(np.nanmin(x), left)
365+
right = max(np.nanmax(x), right)
366366
return left, right
367367

368368

0 commit comments

Comments
 (0)