Hello,
I am trying to plot a date on the x-axis and a time on the y-axis using my dataset, which includes only specific timestamps. I am encountering issues with formatting the y-axis (time). I would like to format the ticks to display in hh:mm format and have a fixed scaling from 05:00 to 22:00.
Thanks in advance.
I have this code (different dataset):
dt = pd.date_range(start='2022-01-01', end='2022-05-31', freq='h')
date = dt.date
time = dt.time
df = pd.DataFrame({'Time': time, 'Date': date})
fig = go.Figure(data=go.Scatter(y=df['Time'], x=df['Date'], mode='markers'))
fig.update_xaxes(
dtick="M1",
tickformat="%b\n%Y",
ticklabelmode="period",
range=["2022-01-01", "2022-12-31"],
ticks="inside",
minor=dict(
ticks="outside",
tickwidth=2,
ticklen=30,
dtick="M12",
),
)
fig.update_yaxes(
dtick="M1",
tickformat="%H",
range=["05:00:00", "22:00:00"],
ticks="inside",
)