Hi, I'm trying to make my first matplotlib-plot from a datafile. The datafile is tab-separated and looks like this: # x-axis y-axis 0 1 1 2 2 3 3 4 4 5 5 6
So my ploting-script is: #!/usr/bin/env python from pylab import * import numpy as np inputfile = '/home/manu/matplotlib-examples/simple_plot.py' x,y = np.loadtxt(inputfile, dtype='float', comments='#', delimiter="\t", converters=None, skiprows=0, usecols=(0,1), unpack=True) plot(x, y, linewidth=1.0) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) show() It worked fine for me once, but as I tried to start the script again I get an IndexError: Traceback (most recent call last): File "./simple_plot.py", line 7, in <module> x,y = np.loadtxt(inputfile, dtype='float', comments='#', delimiter="\t", converters=None, skiprows=0, usecols=(0,1), unpack=True) File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 486, in loadtxt vals = [vals[i] for i in usecols] IndexError: list index out of range Seems to me that usecols has "to much input" (don't know how to call it), but why did it work before? Manuel ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users