我有一个Pandas数据框,其中包含一个流量计开始测量流量的日期和该站退役的日期。我想生成一个图表显示这些日期。以下是我的数据帧示例:
index StationId amin amax
40623 UTAHDWQ-5932100 1994-07-19 13:15:00 1998-06-30 14:51:00
40637 UTAHDWQ-5932230 2006-03-16 13:55:00 2007-01-24 12:55:00
40666 UTAHDWQ-5932240 1980-10-31 16:00:00 2007-07-31 11:35:00
40697 UTAHDWQ-5932250 1981-06-11 17:45:00 1990-08-01 08:30:00
40728 UTAHDWQ-5932253 2006-06-28 13:15:00 2007-01-24 13:35:00
40735 UTAHDWQ-5932254 2006-06-28 13:55:00 2007-01-24 14:05:00
40742 UTAHDWQ-5932280 1981-06-11 15:30:00 2006-08-22 16:00:00
40773 UTAHDWQ-5932290 1992-06-10 15:45:00 1998-06-30 11:33:00
40796 UTAHDWQ-5932750 2005-10-03 16:30:00 2005-10-22 15:00:00
40819 UTAHDWQ-5983753 2006-04-25 09:56:00 2006-04-25 10:00:00
40823 UTAHDWQ-5983754 2006-04-25 11:05:00 2008-04-08 12:16:00
40845 UTAHDWQ-5983755 2006-04-25 13:50:00 2008-04-08 09:10:00
40867 UTAHDWQ-5983756 2006-04-25 14:20:00 2008-04-08 09:30:00
40887 UTAHDWQ-5983757 2006-04-25 12:45:00 2008-04-08 11:27:00
40945 UTAHDWQ-5983759 2008-04-08 13:03:00 2008-04-08 13:05:00
40964 UTAHDWQ-5983760 2008-04-08 13:15:00 2008-04-08 13:23:00
40990 UTAHDWQ-5983775 2008-04-15 12:47:00 2009-04-07 13:15:00
41040 UTAHDWQ-5989066 2005-10-04 10:15:00 2005-10-05 11:40:00
41091 UTAHDWQ-5996780 1995-03-09 13:59:00 1996-03-14 10:40:00
41100 UTAHDWQ-5996800 1995-03-09 15:13:00 1996-03-14 11:05:00
我想创建一个类似的绘图(请注意,我没有使用上述数据绘制此绘图):
绘图不必沿每条线显示文本,只需显示带有桩号名称的y轴。
虽然这看起来像是大熊猫的一个利基应用,但我知道一些科学家会从这种绘制能力中受益。
我能找到的最接近的答案是:
最后一个答案最符合我的需要。
虽然我更喜欢通过Pandas包装器来实现这一点,但我还是很愿意接受一个直截了当的matplotlib解决方案。
也可以使用水平条来完成此操作:^{}
您可以使用Bokeh(一个python库)来制作甘特图,它非常漂亮。 这是我从twiiter复制的代码。 http://nbviewer.jupyter.org/gist/quebbs/10416d9fb954020688f2
我想你是想创造一个甘特图。This建议使用
hlines
:相关问题 更多 >
编程相关推荐