python - Plotting rows corresponding to a given y-value separately -
suppose have table of data-
no. 200 400 600 800 1 13 14 17 18 2 16 18 20 21 3 20 15 18 19
and on...
where each column represents y-value given x-value. first line x-value , first column number of each dataset.
how can read in , plot each row seperately?
for idea of how results table have quoted above see following images. have plotted each plot individually.
matplotlib plots 2d arrays plotting each column, here need transpose data. assuming data in text file called data.csv
.
import numpy np import matplotlib.pyplot plt data = np.loadtxt('data.csv') x = [200, 400, 600, 800] plt.plot(x, data.t) plt.legend((1,2,3)) plt.show()
Comments
Post a Comment