df = [dict(Task="Job A", Start=2, Finish=5.5, Resource='Apple'),
dict(Task="Job B", Start=1, Finish=7, Resource='Grape'),
dict(Task="Job C", Start=1, Finish=2, Resource='Banana')]
I would like to have my gantt chart x axis to show a number or float on the axis instead of the dates that it usually does.
Hi @bhimabi welcome to the forum! You can do this by forcing the xaxis
type to be linear (instead of date)
import plotly.figure_factory as ff
df = [dict(Task="Job A", Start=1, Finish=5.5),
dict(Task="Job B", Start=2, Finish=3),
]
fig = ff.create_gantt(df)
fig.update_layout(xaxis_type='linear')
fig.show()
1 Like
sorry for the necro, but is there a way to do this while using the new plotly express timeline? the styling of the figures produced by figure_factory and plotly express are different, and i would prefer the express version.
updating the layout to make the x-axis linear doesnβt seem to have the same effect with plotly express, with all of the bars disappearing
update: if anyone else stumbles upon this, I found an answer here! python - Plotly Express timeline for Gantt Chart with integer xaxis? - Stack Overflow
2 Likes