Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Timeline with integer/float x axis not working

I saw an example in this forum on how to use the figure factory to produce a gantt chart for integer or float values. Since there are now deprecated and replaced by px.timeline I tried porting the example but it does not work.

Here is some code showing both methods.

Am I missing anything here?

import plotly.figure_factory as ff
import plotly.express as px

df = [dict(Task="Job A", Start=1, Finish=5.5),
      dict(Task="Job B", Start=2, Finish=3),
      ]

#Works
fig = ff.create_gantt(df)
fig.update_layout(xaxis_type='linear')
fig.show()

#Does not work
fig2 = px.timeline(data_frame=df,x_start='Start', x_end='Finish', y='Task')
fig2.update_layout(xaxis_type='linear')
fig2.show()