|
From: Karthikraja V. <vel...@gm...> - 2011-05-27 20:17:03
|
Hello Daniel, The code you have given is simple and works fab. Thank you very much. But I wasn't able to find an example which accesses the columns of a CSV files when I import data through "datafile="filename.csv"" option. It will be great if you could help with accessing individual columns. What excatly I am looking for is to access individual coulmns (of the same CSV file), do calculations using the two coumns and plot them into seperate subplots of the same graph. I modified the script a lil bit. Please find it below: *import matplotlib.pyplot as plt import pylab datafile1 = 'ch1_s1_lrr.csv' datafile2 = 'ch1_s1_baf.csv'* *a1 = pylab.loadtxt(datafile1, comments='#', delimiter=';') b1 = pylab.loadtxt(datafile2, comments='#', delimiter=';')* *v1 = [0,98760,0,1] v2 = [0,98760,-2,2]* *plt.figure(1)* *plt.subplot(4,1,1) print 'loading', datafile1 plt.axis(v2) plt.plot(a1, 'r.')* *plt.subplot(4,1,2) print 'loading', datafile2 plt.axis(v1) plt.plot(b1, 'b.')* *plt.show()* Thank you very much in advance for your time and suggestions. Karthik |