I have a csv file which contains 20 columns. Right now I can plot using this code taking first column as x axis and rest of them as y axis.
import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt('cs.csv',delimiter=',', dtype = float)
a = [row[0] for row in data]
b = [row[1] for row in data]
c = [row[2] for row in data]
fig = plt.figure()
ax = fig.add_subplot(111, axisbg = 'w')
ax.plot(a,b,'g',lw=1.3)
ax.plot(a,c,'r',lw=1.3)
plt.show()
The problem is here I have to define all the columns by using
a = [row[0] for row in data]
this code for all columns one by one. What I want actually to have some method so that it can plot all 19 columns taking first column as x axis constant and plot them in a single window. Any help please.
