1

Is the any way I can add labels or Annotations to grantt plot.

I want dates to display on the bars aside from when I hover the graph.

Here is my code which displays the graph with bars

import plotly.figure_factory as ff

df = [dict(Task="BSA Road-Map-Demo", Start='2021-02-05', Finish='2021-02-12', Resource='To be completed'),
      dict(Task="Retrieve Data via API", Start='2021-02-15', Finish='2021-02-16', Resource='Not Started'),
      dict(Task="Analysis on Expected variables from BSA using custom logic", Start='2021-02-17', Finish='2021-03-03', Resource='Not Started'),
      dict(Task="Demo on custom logic", Start='2021-03-03', Finish='2021-03-04', Resource='To be completed'),
      dict(Task="Models Linears Models/Classifiers/Segmentation", Start='2021-03-04', Finish='2021-03-08', Resource='Not Started'),
      dict(Task="Testing/Evaluation of custom logic and models", Start='2021-03-09', Finish='2021-03-11', Resource='Not Started'),
      dict(Task="Demo on Model testing and evaluation", Start='2021-03-12', Finish='2021-03-13', Resource='To be completed'),
      dict(Task="Model Deployment via API & AWS", Start='2021-03-15', Finish='2021-03-17', Resource='Not Started'),
      dict(Task="Demo on the entire Work-flow", Start='2021-03-18', Finish='2021-03-19', Resource='To be completed')]

colors = {'To be completed': (1, 0.9, 0.16),
          'Not Started': 'rgb(0, 255, 0)',
         }

fig = ff.create_gantt(df, colors=colors, index_col='Resource', show_colorbar=True,bar_width=0.4, showgrid_x=True, showgrid_y=True,title='Income Analysis Roadmap',
                      group_tasks=True)
# fig.update_yaxes(automargin=False)


fig.show()
chuky pedro
  • 756
  • 1
  • 8
  • 26
  • @ChikwukaOkolie The approach in the duplicate target should work perfectly for your use-case as well. If you're having problems implementing it, then just edit your question and focus on the particular problem. Or ask a new question. Either way I'm sure you'll get the required assistance in the end. – vestland Feb 09 '21 at 13:47
  • @vestland The labels does not appear well on the graph the reason for that is because my date range are close – chuky pedro Feb 09 '21 at 15:00
  • Then I suggest that you raise a new question asking how to better customize annotations to suit your particular dataset. Or something to that effect. – vestland Feb 09 '21 at 15:02
  • 1
    @vestland Alright Thanks – chuky pedro Feb 09 '21 at 15:04

0 Answers0