Closed
Description
After upgrading to Plotly 6.x x-axis as DateTimeIndex is not automatically detected as a time x-axis. Instead, it looks like it is UNIX epoch seconds or nanoseconds. Now on Plotly 6.1.2.

This worked in Plotly 5.x.
As a workaround one can manually cast DateTimeIndex
to a list of Python datetime
instances to fix the issue, but this is a bit cumbersome.
Works:
index = df.index.to_pydatetime().tolist()
# Price chart (top subplot)
fig.add_trace({
"x": index,
"y": df["mark_price"],
"type": "scatter",
"mode": "lines",
"name": "Price",
"line": {"width": 2},
"showlegend": False
}, row=1, col=1)
Does not work and produced the screenshot above:
# Price chart (top subplot)
fig.add_trace({
"x": df.index,
"y": df["mark_price"],
"type": "scatter",
"mode": "lines",
"name": "Price",
"line": {"width": 2},
"showlegend": False
}, row=1, col=1)
Metadata
Metadata
Assignees
Labels
No labels