I have created a timeline chart but I can’t seem to figure out how to replace the x axis to plot hours instead of days.
Instead of this x axis:
I’d like something like this:
Here’s the code and the link to the data to reproduce the figure:
import pandas as pd
import plotly.express as px
df = pd.read_csv("graph_data.csv")
df["start_timestamp"] = pd.to_datetime(df["start_timestamp"])
df["end_timestamp"] = pd.to_datetime(df["end_timestamp"])
df["occurrence_date"] = pd.to_datetime(df["occurrence_date"]).dt.weekday
fig = px.timeline(df, x_start="start_timestamp", x_end="end_timestamp", y="occurrence_date",color="occurrence_type")
fig.show()
I tried using xaxis data type as linear but that didn’t work either.
Is there a way to set and consistently see x axis labels from 00:00 to 23:59?