Skip to content Skip to sidebar Skip to footer

Plot Time Periods In Timeline From Pandas

I don't know if this is possible to do with matplotlib or other visualization tools in Anaconda distribution. I know how to do this with JavaScript and may just go that route, but

Solution 1:

If you are open to using plotly, this can take you closer -

df_full = df[['id','start1','end1']].rename(columns={'id':'Task','start1':'Start','end1':'Finish'}).append(
    df[['id','start2','end2']].rename(columns={'id':'Task','start2':'Start','end2':'Finish'}),sort=False).reset_index()

import plotly.plotly as py
import plotly.figure_factory as ff

fig = ff.create_gantt(df_full)
py.iplot(fig, filename='gantt-simple-gantt-chart', world_readable=True)

enter image description here

EDIT

To group tasks together, use -

fig = ff.create_gantt(df_full, group_tasks=True)
py.iplot(fig, filename='gantt-group-tasks-together', world_readable=True)

enter image description here

Solution 2:

broken_barh() in matplotlib would seem to fit your needs. I'd provide more detail, but for that I'd need some sample data.

Solution 3:

you can actually integrate a javascript based timeline in Jupyter Notebook (with all the flexibility it gives). I wrote an explanation here.

Post a Comment for "Plot Time Periods In Timeline From Pandas"