home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1035102667

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/6263#issuecomment-1035102667 https://api.github.com/repos/pydata/xarray/issues/6263 1035102667 IC_kwDOAMm_X849smnL 14371165 2022-02-10T16:07:53Z 2022-02-10T16:07:53Z MEMBER

xarray now relies on matplotlibs converters instead of automatically registering pandas converters, see #6109.

A pure matplotlib version doesn't work either so importing xarray shouldn't all of a sudden change that: ```python import numpy as np import matplotlib.pyplot as plt

times = np.arange(np.datetime64('2001-01-02'), np.datetime64('2002-02-03'), np.timedelta64(75, 'm')) y = np.random.randn(len(times))

fig, ax = plt.subplots() ax.plot(times, y) ax.set_xlim(["2002-01-03","2002-01-20"]) One way is to use datetime64 in set_xlim, which makes sense to me since `times` is `datetime64` as well:python import numpy as np import matplotlib.pyplot as plt

times = np.arange(np.datetime64('2001-01-02'), np.datetime64('2002-02-03'), np.timedelta64(75, 'm')) y = np.random.randn(len(times))

fig, ax = plt.subplots() ax.plot(times, y) ax.set_xlim(np.array(["2002-01-03","2002-01-20"], dtype="datetime64")) ```

Or use pandas converters like xarray did before: ```python import numpy as np import matplotlib.pyplot as plt import pandas as pd

pd.plotting.register_matplotlib_converters()

times = np.arange(np.datetime64('2001-01-02'), np.datetime64('2002-02-03'), np.timedelta64(75, 'm')) y = np.random.randn(len(times))

fig, ax = plt.subplots() ax.plot(times, y) ax.set_xlim(["2002-01-03","2002-01-20"]) ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1130073503
Powered by Datasette · Queries took 1.338ms · About: xarray-datasette