Skip to content

Remove registration of pandas datetime converter in plotting #6109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jan 9, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ New Features

Breaking changes
~~~~~~~~~~~~~~~~
- Rely on matplotlibs default converters instead of pandas (:issue:`6102`, :pull:`6109`).
By `Jimmy Westling <https://github.com/illviljan>`_.


Deprecations
Expand Down
13 changes: 1 addition & 12 deletions xarray/plot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,9 @@
ROBUST_PERCENTILE = 2.0


_registered = False


def register_pandas_datetime_converter_if_needed():
# based on https://github.com/pandas-dev/pandas/pull/17710
global _registered
if not _registered:
pd.plotting.register_matplotlib_converters()
_registered = True


def import_matplotlib_pyplot():
"""Import pyplot as register appropriate converters."""
register_pandas_datetime_converter_if_needed()
# TODO: This function doesn't do anything, remove it?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function doesn't do much anymore without the registration. It can probably be removed later once this PR has been tested a bit in the field.

import matplotlib.pyplot as plt

return plt
Expand Down