python实现时间轴图_Python中的时间轴

本文介绍了一种使用Python3.6绘制时间轴图表的方法,包括使用numpy、pandas和matplotlib等库。代码示例展示了如何创建类似的时间轴,并且能够添加事件和注释。虽然尝试过plotnine和labella包,但作者认为matplotlib是更合适的选择,尽管需要解决将评论添加到事件栏的问题。
摘要由CSDN通过智能技术生成

Is there any way to create a timeline in Python similar to this post using only 1 vizualiation package and no other setup? I have tried to use the plotnine package to use ggplot2 within Python but this is quite cumbersome to get it to work. Furthermore, I have tried the labella package but this requires installation of a Latex distribution. With matplotlib I can't find a way to include the comments next to the event bars.

解决方案

I also had this issue ... and this is my solution. Please ignore the Ugly Color Generation ... this is more of a work in progress.

It is Python 3.6 tested ....

import numpy as np

import matplotlib.pylab as plt

import pandas as pd

from cycler import cycler

from datetime import datetime, timedelta

idx = pd.date_range('2018-1-1', '2018-9-10', freq='1D')

df =

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值