I am trying with one of the example provided at https://plotly.com/python/horizontal-bar-charts/ under the section Colored Horizontal Bar Chart. But instead of number I am using dates
Code
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Bar(
y=['giraffes', 'orangutans', 'monkeys'],
x=['2012-02-02', '2012-02-01', '2012-02-01'],
name='SF Zoo',
orientation='h',
marker=dict(
color='rgba(246, 78, 139, 0.6)',
line=dict(color='rgba(246, 78, 139, 1.0)', width=3)
)
))
fig.add_trace(go.Bar(
y=['giraffes', 'orangutans', 'monkeys'],
x=['2012-02-10', '2012-02-06', '2012-02-28'],
name='LA Zoo',
orientation='h',
marker=dict(
color='rgba(58, 71, 80, 0.6)',
line=dict(color='rgba(58, 71, 80, 1.0)', width=3)
)
))
fig.update_layout(barmode='stack')
fig.show()
I tried with datetime.datetime(2012, 2, 2, 0, 0), still give me a completely wrong graph. I tried playing with the layout format but still couldn't fix this
x=[2, 1, 1]
orx=[10,6,28]
and then add custom xlabels to the axis yourself - Derek O