From: Oz N. <na...@gm...> - 2008-07-16 18:25:09
|
Ok, I played with it a little bit. Here is what I know: importing the data is not a big issue, I aready wrote a tutorial about it here: http://www.tabula0rasa.org/?p=21 here is a sample code I wrote. from matplotlib import pyplot as plt from pylab import * temperature=[ [1,3,4], [2,4,5], [6,3,2] ] distance = (100,200,300) depth = (10,30,50) plt.colorbar() plt.contourf(distance,depth,temperature) plt.gca().invert_yaxis() plt.show() Can I plot the dots as different series on top of the contours ? many many 10x. Oz On Wed, Jul 16, 2008 at 8:58 PM, Eric Firing <ef...@ha...> wrote: > Oz Nahum wrote: > >> Thanks for the quick answer. >> So if I have a series of 18 points withe measured distance, and 18 data >> points with distance, it makes it almost impossible to build the graph ??? I >> can't type 18^18 points.... I want the computer to plot the points and >> extrapulate between them... >> > > I'm puzzled. You said you knew how to read in your data from files, so > there should be no question of having to type too many numbers. > > Eric > >> >> excuse me the possibly dumb question, I am new to sceintific programming >> and for matplotlib >> >> Oz >> >> On Wed, Jul 16, 2008 at 7:51 PM, Eric Firing <ef...@ha... <mailto: >> ef...@ha...>> wrote: >> >> Oz Nahum wrote: >> >> Hi, >> I want to draw a contour plot which uses data from files. I know >> how to import the files, so it's not the main issue. >> Let's say I want to do a profile which has the following data: >> distance, depth and some oceanographic data like temp, oxygen >> and stuff.... >> >> so for simplicity lets say I have: >> >> distance = [1,2,3,4,5,6,7,8,9] >> depth = [1,2,3,4,5,6,7,8,9] >> >> temp = [26.5, 26.2, 26.2, 26.0,25, 24, 22, 21, 18] >> >> >> Too simple. If your grid has 9 points in distance and 9 in depth, >> then you need 81 values of temperature (9 profiles of 9 depths each). >> >> Suppose you have 10 profiles of 8 points each. Then your >> temperature array should have shape (8,10). Your distance and depth >> arrays can either have the same shape as temperature, or both can be >> 1-D, in which case distance.shape = (10,) and depth.shape = (8,). >> Either way, you then use (assuming a current release of mpl) >> >> from matplotlib import pyplot as plt >> plt.contour(distance, depth, temperature) >> plt.gca().invert_yaxis() # so depth increases down the y-axis >> plt.show() >> >> Note that the shape of your temperature array is the transpose of >> what one might expect. This is for matlab compatibility, and goes >> with the idea of looking at an array as it is printed, with the >> column dimension (second index) increasing across the page. >> >> See the contour_demo.py and contourf_demo.py in the mpl examples. >> >> Eric >> >> >> >> how do I produce a countour plot were distanc is X, Y is depth >> and the contours are for temp ? >> >> many thanks... >> Oz >> >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > |