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

add_vline fails with datetime64[ns] #4974

Open
CarlAndersson opened this issue Jan 21, 2025 · 0 comments
Open

add_vline fails with datetime64[ns] #4974

CarlAndersson opened this issue Jan 21, 2025 · 0 comments
Labels
bug something broken P2 considered for next cycle

Comments

@CarlAndersson
Copy link
Contributor

When using datetime64 from numpy with nanosecond precision, the add_vline method does not show any vlines.

Reproducible as follows:

import plotly.graph_objects as go
import numpy as np

t = np.arange(120).astype("timedelta64[s]") + np.datetime64("2025-01-14 08:00")
t = t.astype("datetime64[ns]")
y = np.linspace(0, 1, t.size)
fig = go.Figure()
fig.add_scatter(x=t, y=y)
fig.add_vline(x=t[5])
  • Removing the conversion to "datetime64[ns]" makes the vline appear.
  • Converting to "h", "m", "s", "ms" or "us" all seem to work. (The time spacing have to be modified for hours or minutes.)
  • Converting only the time input to add_vline also resolves the problem.
@gvwilson gvwilson added bug something broken P2 considered for next cycle labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

2 participants