我的数据框如下所示。
Time Volume
Index
0 16:18:40.505530 1
1 16:18:40.510560 1
2 16:18:40.524660 1
3 16:18:40.693910 1
4 16:18:40.900390 2
5 16:18:40.902290 1
6 16:18:41.296110 4
7 16:18:41.898610 1
8 16:18:42.099940 1
9 16:18:42.303210 3
10 16:18:42.497490 1
11 16:18:43.095560 1
.....
>> df.Time
....
Name: Time, Length: 103248, dtype: timedelta64[ns]
我的目标是绘制此数据并将索引和时间列设置为x轴。 如果仅将索引作为x轴,我可以很容易地绘制它,就像这样。
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
ax1.scatter(df.index,df.Volume, marker='+', s=1 )
但我不知道如何使用时间列添加另一个x轴。
答案 0 :(得分:0)
双x轴意味着什么?
如果你想同时展示它们 - 尝试连接值。 如果您希望时间是x轴,请运行:
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
ax1.scatter(df.Time,df.Volume, marker='+', s=1 )