如何在Plotly甘特图中清晰区分同资源的连续任务
问题:Plotly甘特图同一资源连续任务的区分方法
我在Plotly甘特图中配置了同一资源(Resource A)的两个连续任务,由于资源相同,甘特图使用同一颜色渲染,导致视觉上二者看似一个长流程,而非两个独立任务。我希望添加分隔线或通过其他方式明确区分这两个任务,预期效果见附图。
测试代码如下:
import pandas as pd import plotly.figure_factory as ff values = [] values.append(dict(Task="John",Start=0,Finish=10,Resource="A")) values.append(dict(Task="John",Start=10,Finish=20,Resource="A")) df = pd.DataFrame(values) fig = ff.create_gantt(df, index_col='Resource', bar_width=0.4, show_colorbar=True, group_tasks=True, title="Simulation") fig.update_layout(xaxis_type='linear', autosize=False, width=800, height=400) fig.show()
内容的提问来源于stack exchange,提问作者GuiGui
相关产品推荐
相关产品推荐

