我有數據是這樣的:情節時間軸圖沒有任何計數
Id recordDate bodytag recordType
123 2017-05-02 A A1
123 2017-05-05 B B1
123 2017-05-10 A A1
123 2017-04-02 A A1
234 2016-05-17 C C1
234 2016-06-14 D D1
234 2016-05-25 D D1
234 2017-05-13 D D1
234 2017-05-13 C C1
234 2016-05-25 C C1
234 2017-05-13 C C1
現在我要繪製時間線圖一樣,患者ID 123對日期17年2月5日有疼痛的組合部分並且具有捕獲記錄A1並且在日期05/5/17在身體部分B中具有疼痛,因此他捕獲了記錄B1。對於每個用戶我想製作這種時間線圖表。
我該如何在Python中做到這一點?
到目前爲止,我想這件事
fig, ax = plt.subplots(figsize=(6,1))
ax.plot_date(dump['recordDate'],dump['Actual_bodyTags'])
fig.autofmt_xdate()
# everything after this is turning off stuff that's plotted by default
"""
ax.yaxis.set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.xaxis.set_ticks_position('bottom')
ax.get_yaxis().set_ticklabels([])
day = pd.to_timedelta("1", unit='D')
#plt.xlim(X[0] - day, X[-1] + day)
"""
plt.show()
而且這樣的:
fig = ff.create_gantt(dump, colors=['#333F44', '#93e4c1'], index_col='Complete', show_colorbar=True,
bar_width=0.2, showgrid_x=True, showgrid_y=True)
py.iplot(fig, filename='gantt-use-a-pandas-dataframe', world_readable=True)
也許用'plotly'的甘特圖功能:https://plot.ly/python/gantt/ –
沒有人知道如何去做吧 ? – Jitesh
也許很多人都知道如何做到這一點,但沒有人願意爲你做這件事,甚至沒有你展示你的嘗試。如果你第一次嘗試一些東西,看看文檔和例子,你遇到了一個問題,每個人都很樂意幫助你。顯示你的嘗試,你是卡... –