Skip to content
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

proplot can't plot string like datetime #436

Open
singledoggy opened this issue Aug 28, 2023 · 0 comments
Open

proplot can't plot string like datetime #436

singledoggy opened this issue Aug 28, 2023 · 0 comments

Comments

@singledoggy
Copy link

Description

proplot can't plot string like datetime

Steps to reproduce

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you.

import pandas as pd
import numpy as np
start_date = '2023-01-01'
end_date = '2023-12-31'

dates = pd.date_range(start=start_date, end=end_date, freq='D')

data = np.random.randn(len(dates))

time_series = pd.Series(data, index=dates)

# proplot
import proplot as pplt
import matplotlib.pyplot as plt
fig, axs = pplt.subplots(ncols=1, nrows=1, figwidth=13, refaspect=4,)
time_series.plot(ax=axs)
axs.hlines(0.8, start_date, end_date)
plt.hlines(0.5, start_date, end_date)
axs.format(
    suptitle='', xlabel='xlabel', ylabel='ylabel', abc=True,
)

# %%
# matplotlib
fig, axs = plt.subplots()
time_series.plot(ax=axs)
axs.hlines(0.8, start_date, end_date)
plt.hlines(0.5, start_date, end_date)
axs.format(
    suptitle='', xlabel='xlabel', ylabel='ylabel', abc=True,
)

Expected behavior: [What you expected to happen]
image

Actual behavior: [What actually happened]
image

Equivalent steps in matplotlib

Please try to make sure this bug is related to a proplot-specific feature. If you're not sure, try to replicate it with the native matplotlib API. Matplotlib bugs belong on the matplotlib github page.

See the code above.

Proplot version

Paste the results of import matplotlib; print(matplotlib.__version__); import proplot; print(proplot.version) here.
3.4.3
0.9.5.post360

How to quick fix

start_date = np.datetime64('2022-01-01')
end_date = np.datetime64('2023-12-31')

Proplot is capable of accepting datetime formats other than string formats. However, if it does not support accepting string inputs as datetimes, it would be advisable to raise a warning to avoid confusion among users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant