【发布时间】:2019-10-04 22:00:48
【问题描述】:
我有一个看起来像这样的 pandas df:
|---------------------|------------------|-----------|
| timestamp | clocktime | value |
|---------------------|------------------|-----------|
| 1 | 8:30 | 10 |
|---------------------|------------------|-----------|
| 2 | 8:31 | 20 |
|---------------------|------------------|-----------|
| 3 | 8:33 | 15 |
|---------------------|------------------|-----------|
我已经设法在 x 轴上使用 timestamp 和在 y 轴上使用 value 绘制它。有没有办法用clocktime 创建第二个x 轴作为它的值?问题是我有超过 100k 行,所以我不能打印每个 clocktime 条目(每个 clocktime 条目都是一个字符串)。有没有办法在同一个图上将timestamp 和clocktime 显示为两个单独的x 轴,并且两者都有一些智能刻度间距?我正在使用 matplotlib,并使用 Axes.axes 对象绘制它。
【问题讨论】:
-
你能用一些代码编辑你的帖子吗?
标签: python pandas matplotlib