Skip to content

Commit 0a7bbbe

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

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
@@ -31,7 +31,8 @@
3131
from pandas.util._decorators import Appender
3232

3333
from pandas.plotting._compat import (_mpl_ge_1_3_1,
34-
_mpl_ge_1_5_0)
34+
_mpl_ge_1_5_0,
35+
_mpl_ge_2_0_0)
3536
from pandas.plotting._style import (mpl_stylesheet, plot_params,
3637
_get_standard_colors)
3738
from pandas.plotting._tools import (_subplots, _flatten, table,
@@ -969,9 +970,10 @@ def _make_plot(self):
969970
**kwds)
970971
self._add_legend_handle(newlines[0], label, index=i)
971972

972-
lines = _get_all_lines(ax)
973-
left, right = _get_xlim(lines)
974-
ax.set_xlim(left, right)
973+
if not _mpl_ge_2_0_0():
974+
lines = _get_all_lines(ax)
975+
left, right = _get_xlim(lines)
976+
ax.set_xlim(left, right)
975977

976978
@classmethod
977979
def _plot(cls, ax, x, y, style=None, column_num=None,

0 commit comments

Comments
 (0)