You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plotly 6.3.0 does not work with numpy datetime #5355
I upgraded my requirements from plotly==5.9.0 to plotly==6.3.0 and observed a regression. Markers on the plot disappeared without any error.
Simply put, my code takes a figure as input and plots a dot at the end of each line. Simple reproducible example:
importnumpyasnpimportpandasaspdimportplotly.graph_objsaspgoimportplotly.subplotsnp.random.seed(42)
# random datadates=pd.date_range(start="2025-01-01", periods=3, freq="D")
data=np.random.randn(3, 1)
df=pd.DataFrame(data, index=dates, columns=["value"])
# this is plotted elsewherefig=plotly.subplots.make_subplots()
forcolumnindf.columns:
trace=pgo.Scatter(
x=df.index,
y=df[column],
mode="lines",
)
fig.add_trace(trace)
# take the figure and# render last point of each line using fig.datafori, traceinenumerate(fig.data):
input_x=trace.x[-1]
input_y=trace.y[-1]
print("Input x:", input_x, type(input_x))
print("Input y:", input_y, type(input_y))
fig.add_scatter(
x=(input_x,),
y=(input_y,),
mode="markers+text",
)
print(f"Plotted x value:", fig.data[-1].x)
fig.show()
If I run this with different plotly versions I get different type for the timestamp:
With plotly<6, the figure looks like this
With plotly>=6, it looks like this
I am aware that I can convert numpy datetime back to datetime.datetime to fix my problem but why does plotly treat numpy datetime as a unix timestamp? It's not being converted to an actual date and there is no error either.
Simply put I would expect x axis to be a date and not an impossibly large number:
Activity
[-]Question. Why does plotly not work with numpy datetime[/-][+]plotly 5.3.0 does not work with numpy datetime[/+][-]plotly 5.3.0 does not work with numpy datetime[/-][+]plotly 6.3.0 does not work with numpy datetime[/+]boomshankerx commentedon Oct 13, 2025
Is there a workaround for this other than downgrading plotly and kaleido?
BlastoiseBlue commentedon Oct 16, 2025
Try converting the timestamps to a different precision, such as
datetime64[us]plotly/kaleido#236 (comment)ayjayt commentedon Nov 4, 2025
This should be fixed with v1.2.0