From: Eric F. <ef...@ha...> - 2008-07-16 18:38:15
|
Oz Nahum wrote: > 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 ? First you have to make your basic example work; what you posted above does not. 1) For an example like this, use a different number of points in the x and y directions, to make it clear how the arrays are oriented. 2) The colorbar command must *follow* the contourf command. 3) Make your test temperature profiles more reasonable, i.e. temperature decreasing with depth, so you can see whether your plot is doing the right thing. 4) Omit the "from pylab import *" 5) Once you start doing real work, you will need numpy. The suggested import syntax is "import numpy as np". 6) Study the examples that come with mpl. Eric |