Is there a quick and easy way to plot the columns of a
> matrix versus a vector and get different color lines for
> each column?
You can build a color list and cycle through it with a counter, as
described in the recent thread "Plotting of multiple spectras" on the
mailing list. Eg
colors = ("b", "g", "r", "c", "m", "y", "k")
ind = 1
while ind < 18:
Y = take(X,(0,ind), 1)
x = Y[:,0]
y = Y[:,1]
plot(x,y,"-"+colors[ind % len(colors)])
ind = ind + 2
> line Do I need to define a matrix plotting function like def
> matrixplot(xvect,ymat): ioff() for i in
> range(shape(ymat)[1]): plot(xvect,ymat[:,i]) show() ion() or
> is there an easier/faster way? Ryan
Yes, this is one area in which the mpl plot function differs from
matlab. There is a faster way, using line collections. This
difference in speed would be considerable for a large number of
lines. See examples/line_collections.py in matplotlib CVS.
JDH