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 Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users