Untitled

 avatar
unknown
python
2 years ago
651 B
6
Indexable
files = [r'001.dat',
         r"002.dat",
         r"003.dat",
         r"004.dat",
         r"005.dat"]

x = []
y = []

for name in files:
    with open(name, "r") as f:
        data = [i[:-1].split() for i in f.readlines()]
        first = int(str(data[0])[2:-2])
        x.append([float(i[0]) for i in data[1:first+1]])
        y.append([float(i[1]) for i in data[1:first+1]])

for i in range(len(x)):
    
    fig, ax = plt.subplots()
    ax.scatter(x[i], y[i], s=(2 if i==4 else None)
    ax.figure.set_size_inches(7,3)
    ax.set_title("Number of points:" + str(len(x[i])))
    ax.set_title("Number of points:" + str(len(x[i])))

    plt.show()
Editor is loading...