This is a Gantt chart with plotly
The content of "test.data":
The format is: Task\tStart\tFinish\tResource
A 2017-04-26 10:12:04 2017-04-26 10:34:18 Done
B 2017-04-26 10:54:18 2017-04-26 11:07:41 Done
C 2017-04-26 11:47:42 2017-04-26 12:25:12 Done
A 2017-04-26 12:35:12 2017-04-26 13:28:29 Done
B 2017-04-26 13:48:29 2017-04-26 14:07:50 Done
A 2017-04-26 14:37:50 2017-04-26 15:12:08 Done
B 2017-04-26 15:32:09 2017-04-26 15:44:43 Done
C 2017-04-27 07:14:46 2017-04-27 07:29:48 Done
A 2017-04-27 08:49:48 2017-04-27 09:06:07 Done
A 2017-04-27 09:38:03 2017-04-27 09:59:03 Done
C 2017-04-27 10:09:03 2017-04-27 10:27:40 Done
B 2017-04-27 11:07:40 B2017-04-27 11:23:48 Done
Here is the code:
import plotly.offline as offline
import plotly.plotly as py
import plotly.figure_factory as ff
import plotly.graph_objs as go
import plotly.io as pio
import pandas as pd
import numpy as np
filePath="test.data"
df = pd.read_table(filePath,
header=None,
usecols=[0,1,2,3],
sep='\t',
converters={1:np.datetime64, 2:np.datetime64},
)
df.columns = ['Task', 'Start', 'Finish', 'Resource']
colors = {'Done': 'rgb(0, 240, 0)',}
fig = ff.create_gantt(df,
title='My Tasks',
bar_width=0.1,
showgrid_x=False,
showgrid_y=False,
colors=colors,
#colors='Viridis',
index_col='Resource',
show_colorbar = True,
group_tasks=True,
)
fig['layout'].update(plot_bgcolor = 'rgba(0,0,0,250)',
paper_bgcolor = 'rgba(0,0,0,0)',
showlegend = True,
violinmode='overlay',
colorway = ['rgb(0, 150, 0)'],
)
pio.write_image(fig, 'testdata.pdf', format='pdf', width=1000, height=1000, scale=1)
The output:
