我有5个txt文件,其中包含的数据给予我的影响,增加热量对我的样品,我想把它们绘制在一个垂直堆叠图,其中最后的数字是5个垂直堆叠图共享相同的X轴,每条线在一个单独的,以揭示它们之间的差异。
我写了这段代码:
import glob
import pandas as pd
import matplotlib.axes._axes as axes
import matplotlib.pyplot as plt
input_files = glob.glob('01-input/RR_*.txt')
for file in input_files:
data = pd.read_csv(file, header=None, delimiter="\t").values
x = data[:,0]
y = data[:,1]
plt.subplot(2, 1, 1)
plt.plot(x, y, linewidth=2, linestyle=':')
plt.tight_layout()
plt.xlabel('x-axis')
plt.ylabel('y-axis')
但结果只有一个包含所有直线的图形:
我想得到下面的图表:
1条答案
按热度按时间o2rvlv0m1#