Open
Description
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.