小编Shr*_*van的帖子

Matplotlib:如何使用broken_barh的时间戳?

我有一个pandas数据帧,时间戳作为索引和列中的数值.我想使用broken_bar绘制矩形以突出显示时间序列的某些部分.如何使用broken_barh的时间戳?

df.plot(ax = ax)
ax.broken_barh([(startTs, pd.offsets.Week())], (10,50), facecolors = colors, alpha = 0.25)
# Where type(startTs) is pandas.tslib.Timestamp
Run Code Online (Sandbox Code Playgroud)

当我执行上面的代码片段时,我得到'参数必须是字符串或数字'错误.

提前致谢.

python plot matplotlib pandas

2
推荐指数
1
解决办法
2549
查看次数

标签 统计

matplotlib ×1

pandas ×1

plot ×1

python ×1