From: Oz N. <na...@gm...> - 2008-07-16 17:11:02
|
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... 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...> 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 >> > |