|
From: Ryan K. <rya...@co...> - 2005-05-14 19:50:48
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <div class="moz-text-html" lang="x-western"> <div class="moz-text-flowed" style="font-family: -moz-fixed; font-size: 12px;" lang="x-western">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? If I try <br> <br> In [50]: shape(timevector) <br> Out[50]: (21001, 1) <br> <br> In [51]: shape(datamatrix) <br> Out[51]: (21001, 3) <br> <br> In [52]: plot(timevector,datamatrix) <br> I get: <br> RuntimeError: xdata and ydata must be the same length <br> <br> In matlab, this would give me 3 diffent color lines, one for each column of datamatrix. <br> <br> plot(timevector,datamatrix[:,i]) works just fine for one line<br> <br> Do I need to define a matrix plotting function like<br> <br> def matrixplot(xvect,ymat): <br> ioff() <br> for i in range(shape(ymat)[1]): <br> plot(xvect,ymat[:,i]) <br> show() <br> ion() <br> <br> or is there an easier/faster way?<br> <br> Ryan <br> <br> <br> <br> <br> </div> </div> </body> </html> |