Построение нескольких графиков на основе данных из файла
mplot8.py
— 1 KB
Содержимое файла
"""A file contains N columns of values, describing N–1 curves. The first column contains the x coordinates, the second column contains the y coordinates of the first curve, the third column contains the y coordinates of the second curve, and so on. We want to display those N–1 curves. We will do so by using the following code: """ import numpy as np import matplotlib.pyplot as plt data = np.loadtxt('my_data1.txt') for column in data.T: #метод .T транспонирует матрицу plt.plot(data[:,0], column) plt.show()