Also, you are using some parameters (usecols, unpack) to
> load() that
> http://matplotlib.sourceforge.net/matplotlib.pylab.html#-load
> doesn't know about.
The web page is a bit out of date and needs updating -- thanks for the
pointers to the stale and broken links. The "load" parameters used
here were recently introduced. I suggest keeping an ipython shell
open when working with matplotlib, so you have ready access to the
online help
In [1]: help load
load(fname, comments='%', delimiter=None, converters=None,
skiprows=0, usecols=None, unpack=False):
Load ASCII data from fname into an array and return the array.
The data must be regular, same number of values in every row
fname can be a filename or a file handle. Support for gzipped
files is automatic, if the filename ends in .gz
matfile data is not currently supported, but see
Nigel Wade's matfile ftp://ion.le.ac.uk/matfile/matfile.tar.gz
Example usage:
X = load('test.dat') # data in two columns
t = X[:,0]
y = X[:,1]
Alternatively, you can do the same with "unpack"; see below
X = load('test.dat') # a matrix of data
x = load('test.dat') # a single column of data
comments - the character used to indicate the start of a comment
in the file
delimiter is a string-like character used to seperate values in the
file. If delimiter is unspecified or None, any whitespace string is
a separator.
converters, if not None, is a dictionary mapping column number to
a function that will convert that column to a float. Eg, if
column 0 is a date string: converters={0:datestr2num}
skiprows is the number of rows from the top to skip
usecols, if not None, is a sequence of integer column indexes to
extract where 0 is the first column, eg usecols=(1,4,5) to extract
just the 2nd, 5th and 6th columns
unpack, if True, will transpose the matrix allowing you to unpack
into named arguments on the left hand side
t,y = load('test.dat', unpack=True) # for two column data
x,y,z = load('somefile.dat', usecols=(3,5,7), unpack=True)
See examples/load_demo.py which exeercises many of these options.