相关疑难解决方法(0)

如何在matplotlib的给定图上绘制垂直线?

给定时间表示中的信号图,如何绘制标记相应时间指标的线?

具体来说,给定时间索引范围为0到2.6(s)的信号图,我想绘制垂直红线,表示列表的相应时间索引[0.22058956, 0.33088437, 2.20589566],我该怎么办?

python matplotlib

220
推荐指数
6
解决办法
30万
查看次数

大熊猫绘制时间序列图,在选定日期显示垂直线

考虑这个时间序列,维基百科类别中的累计编辑数.

In [555]:
cum_edits.head()
Out[555]:
2001-08-31 23:37:28    1
2001-09-01 05:09:28    2
2001-09-18 10:01:17    3
2001-10-27 06:52:45    4
2001-10-27 07:01:45    5
Name: edits, dtype: int64
In [565]:
cum_edits.tail()
Out[565]:
2014-01-29 16:05:15    53254
2014-01-29 16:07:09    53255
2014-01-29 16:11:43    53256
2014-01-29 18:09:44    53257
2014-01-29 18:12:09    53258
Name: edits, dtype: int64
Run Code Online (Sandbox Code Playgroud)

我要像这样绘制图形:

In [567]:

cum_edits.plot()

Out[567]:

<matplotlib.axes.AxesSubplot at 0x1359c810>
Run Code Online (Sandbox Code Playgroud)

累积编辑

我希望在每次total_edits/n ; e.g. n=10编辑后也绘制垂直线.我很容易计算出来.

In [568]:

dates

Out[568]:

[Timestamp('2006-06-04 04:46:22', tz=None),
 Timestamp('2007-01-28 23:53:02', tz=None),
 Timestamp('2007-09-16 10:52:02', tz=None),
 Timestamp('2008-04-28 21:20:40', tz=None),
 Timestamp('2009-04-12 22:07:13', tz=None), …
Run Code Online (Sandbox Code Playgroud)

python matplotlib pandas

18
推荐指数
1
解决办法
1万
查看次数

标签 统计

matplotlib ×2

python ×2

pandas ×1