创建图表共享轴Python

时间:2017-05-05 01:37:50

标签: python csv

我有一个包含4列的csv文件。第一列表示日期,其他三列表示学生的姓名。如果他在某一天上学,那么他的价值为100,如果他不在,则为0。我想知道如何在python中绘制这些数据?

这就是我希望它看起来像每个学生有多个x轴的地方。我还在右侧包含了数据的示例照片,可在此处找到示例csv文件:CSV SAMPLE FILEenter image description here

1 个答案:

答案 0 :(得分:0)

我在共享轴方面找到了类似的结果,如link所示: enter image description here

# Three subplots sharing both x/y axes
f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing both axes')
ax2.scatter(x, y)
ax3.scatter(x, 2 * y ** 2 - 1, color='r')