diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index 2469b8191c175..c828be47a795e 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -256,7 +256,7 @@ Period Plotting ^^^^^^^^ -- +- ``ax.set_xlim`` was sometimes raising ``UserWarning`` which users couldn't address due to ``set_xlim`` not accepting parsing arguments - the converter now uses :func:`Timestamp` instead (:issue:`49148`) - Groupby/resample/rolling diff --git a/pandas/plotting/_matplotlib/converter.py b/pandas/plotting/_matplotlib/converter.py index 6eb77b63f5356..70fca27c837f3 100644 --- a/pandas/plotting/_matplotlib/converter.py +++ b/pandas/plotting/_matplotlib/converter.py @@ -152,9 +152,7 @@ def _to_ordinalf(tm: pydt.time) -> float: def time2num(d): if isinstance(d, str): - parsed = tools.to_datetime(d) - if not isinstance(parsed, datetime): - raise ValueError(f"Could not parse time {d}") + parsed = Timestamp(d) return _to_ordinalf(parsed.time()) if isinstance(d, pydt.time): return _to_ordinalf(d)