Plotly: How to remove header and rangeselector from Gantt Chart?

Viewed 407

I created a gantt chart using plotly and it shows up as shown:

enter image description here

How do I remove the top part within rectangle highlighted section?

My current code is as follows:

import plotly.figure_factory as ff
fig = ff.create_gantt(df2, show_colorbar=True, group_tasks=True)
fig.update_layout(showlegend=False)
1 Answers

To remove the title, use:

fig.layout.title = None

To remove the rangeselector, use:

fig.layout.xaxis.rangeselector = None

enter image description here

Complete code:

import plotly.figure_factory as ff

df = [dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28'),
      dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15'),
      dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30')]

fig = ff.create_gantt(df)
fig.layout.title = None
fig.show()
Related