Missing functionality in `px.timeline` against `create_gantt()` figure factory
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
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()
Obtaining:

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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 px.timeline 入口开始,将其行为与 create_gantt() 图表工厂进行比较,尤其关注示例中展示的 group_tasks 参数。检查 create_gantt() API 文档,补充缺失的参数说明。当重复任务可以按照定义的顺序渲染在 y 轴的不同线上,并且相关行为已有文档说明时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100
