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> |
From: John H. <jdh...@ac...> - 2005-05-16 14:08:24
|
>>>>> "Ryan" == Ryan Krauss <rya...@co...> writes: Ryan> Is there a quick and easy way to plot the columns of a Ryan> matrix versus a vector and get different color lines for Ryan> 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 Ryan> line Do I need to define a matrix plotting function like def Ryan> matrixplot(xvect,ymat): ioff() for i in Ryan> range(shape(ymat)[1]): plot(xvect,ymat[:,i]) show() ion() or Ryan> 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 |
From: Graeme O'K. <gj...@ne...> - 2005-05-17 13:54:22
|
I have just upgraded to OS X 10.4 on two machines. On one machine, pylab worked fine, on my notebook it hangs. I have begun trying to rebuild my fink tree but bomb at glib 2.6.2 / gtk+, pango-1.8.0 using fink as well as standalone installs for old items (pango is at 1.6 on fink, need 1.8 for gtk+2.6.0). As an aside, numarray install bombed with gcc4.0 so I had to revert to gcc3.3. Anyone else had problems with OS X 10.4 and pylab? regards, Graeme |
From: Graeme O'K. <gj...@ne...> - 2005-05-17 23:23:27
|
Hi Jeff, yes, I did (fink-0.23.9.tar.gz install, ./bootstrap.sh etc. all went well and I was able to re-install emacs which had also broken with the 10.4 upgrade.) I shall await 10.4 upgrades. In the interim, http://pythonmac.org/packages/matplotlib-0.72.1-py2.3-macosx10.3.zip http://pythonmac.org/packages/numarray-1.1.1-py2.3-macosx10.3.zip http://pythonmac.org/packages/TigerPython23Compat.pkg.zip (fixes up site-packages location) have allowed me to get pylab imported, now I just need to get a backend compiled (gtk is my preferred backend). thanks, Graeme On 18/05/2005, at 12:06 AM, Jeff Whitaker wrote: > Graeme O'Keefe wrote: > > >> I have just upgraded to OS X 10.4 on two machines. On one >> machine, pylab worked fine, on my notebook it hangs. I have begun >> trying to rebuild my fink tree but bomb at glib 2.6.2 / gtk+, >> pango-1.8.0 using fink as well as standalone installs for old >> items (pango is at 1.6 on fink, need 1.8 for gtk+2.6.0). >> >> As an aside, numarray install bombed with gcc4.0 so I had to >> revert to gcc3.3. >> >> Anyone else had problems with OS X 10.4 and pylab? >> >> regards, >> >> Graeme >> >> >> >> >> > Graeme: Did you follow the instructions for upgrading fink for > 10.4 on the fink home page? It's a tricky upgrade - many (if not > all) packages need to rebuilt. Many packages are not yet working, > since many developers (like me) don't yet have 10.4. > > -Jeff > > > -- > Jeffrey S. Whitaker Phone : (303)497-6313 > NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449 > 325 Broadway Web : http://www.cdc.noaa.gov/~jsw > Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124 > > |