情节:订购甘特图以在左上角而不是左下角显示最早的项目
Plotly: Order Gantt chart to display earliest item in top left not bottom left
我正在尝试使用 plotly 制作简单的甘特图,但出于某种原因,最早的项目显示在左下角,而不是应有的左上角。
有办法改变吗?该示例来自下面的文档(已修复,因此它将 运行):
import plotly.figure_factory as ff
df = [dict(Task="Job A", Start='2009-01-01',
Finish='2009-02-28', Complete=10),
dict(Task="Job B", Start='2009-03-05',
Finish='2009-04-15', Complete=60),
dict(Task="Job C", Start='2009-02-20',
Finish='2009-05-30', Complete=95)]
fig = ff.create_gantt(df, colors='Blues', index_col='Complete',
show_colorbar=True, bar_width=0.5,
showgrid_x=True, showgrid_y=True)
fig.show()
output from code
我们将忽略 showgrid 似乎不起作用。这是因为默认颜色是白底白字。
import plotly.figure_factory as ff
df = [dict(Task='Job A', Start='2009-01-01', Finish='2009-02-28', Complete=10),
dict(Task='Job B', Start='2009-03-05', Finish='2009-04-15', Complete=60),
dict(Task='Job C', Start='2009-02-20', Finish='2009-05-30', Complete=95)]
fig = ff.create_gantt(df, colors='Blues', index_col='Complete', show_colorbar=True,
bar_width=0.5, showgrid_x=True, showgrid_y=True)
fig.update_layout(plot_bgcolor='white', # change the plot background color
yaxis=dict(autorange='reversed', # reverse the order of the y-axis tick labels
linecolor='gray', # change the color of the y-axis line
gridcolor='gray'), # change the color of the y-axis grid lines
xaxis=dict(linecolor='gray', # change the color of the x-axis line
gridcolor='gray')) # change the color of the x-axis grid lines
fig.show()
我正在尝试使用 plotly 制作简单的甘特图,但出于某种原因,最早的项目显示在左下角,而不是应有的左上角。
有办法改变吗?该示例来自下面的文档(已修复,因此它将 运行):
import plotly.figure_factory as ff
df = [dict(Task="Job A", Start='2009-01-01',
Finish='2009-02-28', Complete=10),
dict(Task="Job B", Start='2009-03-05',
Finish='2009-04-15', Complete=60),
dict(Task="Job C", Start='2009-02-20',
Finish='2009-05-30', Complete=95)]
fig = ff.create_gantt(df, colors='Blues', index_col='Complete',
show_colorbar=True, bar_width=0.5,
showgrid_x=True, showgrid_y=True)
fig.show()
output from code
我们将忽略 showgrid 似乎不起作用。这是因为默认颜色是白底白字。
import plotly.figure_factory as ff
df = [dict(Task='Job A', Start='2009-01-01', Finish='2009-02-28', Complete=10),
dict(Task='Job B', Start='2009-03-05', Finish='2009-04-15', Complete=60),
dict(Task='Job C', Start='2009-02-20', Finish='2009-05-30', Complete=95)]
fig = ff.create_gantt(df, colors='Blues', index_col='Complete', show_colorbar=True,
bar_width=0.5, showgrid_x=True, showgrid_y=True)
fig.update_layout(plot_bgcolor='white', # change the plot background color
yaxis=dict(autorange='reversed', # reverse the order of the y-axis tick labels
linecolor='gray', # change the color of the y-axis line
gridcolor='gray'), # change the color of the y-axis grid lines
xaxis=dict(linecolor='gray', # change the color of the x-axis line
gridcolor='gray')) # change the color of the x-axis grid lines
fig.show()