Horizontal bar plotly with datetime

I wanted to create a timeline graph with horizontal bar. I tried the following code:

import plotly.graph_objects as go

fig = go.Figure()
fig.add_trace(go.Bar(
    y=['AndOn'],
    x=["22-07-01 00:00:8"],
    name='SF Zoo',
    orientation='h',
    legendgroup="group1",
    marker=dict(
        color='rgba(246, 78, 139, 0.6)',
        line=dict(color='rgba(246, 78, 139, 1.0)', width=1)
    )
))
fig.add_trace(go.Bar(
    y=['AndOn'],
    x=["22-07-01 00:00:18"],
    name='LA Zoo',
    legendgroup="group2",
    orientation='h',
    marker=dict(
        color='rgba(58, 71, 80, 0.6)',
        line=dict(color='rgba(58, 71, 80, 1.0)', width=1)
    )
))

fig.add_trace(go.Bar(
    y=['AndOn'],
    x=["22-07-01 00:00:5"],
    name='SF Zoo',
    legendgroup="group1",
    orientation='h',
    marker=dict(
        color='rgba(246, 78, 139, 0.6)',
        line=dict(color='rgba(246, 78, 139, 1.0)', width=1)
    )
))

fig.update_layout(barmode='stack')
fig.show()

The date time in x axis is not showing correct. one solution could be to use px.timeline() like [this] answer. (python - plotly horizontal stacked bar chart not working with x-axis in dates - Stack Overflow)
But i don’t want to use plotly express. How to do this using graph object?

Hi,

You can use the figure factory, but it is not a graph object and it is pretty similar to px.timeline: Gantt charts in Python

can i use it to make subplots (not facet)?

Also, I can not understand, why the DateTime is not correct?

What do you mean?

I mean, if i run the code that i have given , the timeline is not correct.