Skip to content

Commit 18e649c

Browse files
committed
Plotting: Let new MPL automatically determine xlims
* Avoid setting xlims since recent matplotlib already does it correctly * and we should let it apply its default styles where possible (pandas-dev#15495)
1 parent bfdfbe0 commit 18e649c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pandas/plotting/_core.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
from pandas.util._decorators import Appender
3030

3131
from pandas.plotting._compat import (_mpl_ge_1_3_1,
32-
_mpl_ge_1_5_0)
32+
_mpl_ge_1_5_0,
33+
_mpl_ge_2_0_0)
3334
from pandas.plotting._style import (mpl_stylesheet, plot_params,
3435
_get_standard_colors)
3536
from pandas.plotting._tools import (_subplots, _flatten, table,
@@ -942,9 +943,10 @@ def _make_plot(self):
942943
**kwds)
943944
self._add_legend_handle(newlines[0], label, index=i)
944945

945-
lines = _get_all_lines(ax)
946-
left, right = _get_xlim(lines)
947-
ax.set_xlim(left, right)
946+
if not _mpl_ge_2_0_0():
947+
lines = _get_all_lines(ax)
948+
left, right = _get_xlim(lines)
949+
ax.set_xlim(left, right)
948950

949951
@classmethod
950952
def _plot(cls, ax, x, y, style=None, column_num=None,

0 commit comments

Comments
 (0)