Open
Description
create_gantt()
figure factory is deprecated in favor of px.timeline
, but create_gantt()
has the feature (argument) group_tasks
that is not present with px.timeline
.
An additional issue is that the group_task
argument is not explained in the create_gantt()
documentation check here.
For example, the code:
import plotly.express as px
import pandas as pd
df = pd.DataFrame([
dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Resource='Alex'),
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Resource='Max'),
dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Resource='Max'),
dict(Task="Job A", Start='2009-03-02', Finish='2009-05-30', Resource='Alex')
])
fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", color = "Resource")
fig.update_yaxes(autorange="reversed") # otherwise tasks are listed from the bottom up
fig.show()
And I would like to have each tasks in the input data frame into its own line in the y-axis, even for repeating tasks:
We can obtain this using create_gantt()
like:
from plotly.figure_factory import create_gantt
fig = create_gantt(df, index_col='Resource',
showgrid_x=True, showgrid_y=True,
show_colorbar=True,
group_tasks=False
)
fig.update_yaxes(autorange="reversed")
fig.show()
The order follows the order in the df
which I found a correct behavior, but an extra input to define the order in create_gantt()
would be useful.