Hi Eric,
really thanks for your help so far. I am doing a quick short course, and
I'll do the examples later.
I've fixed the code, here it is:
from matplotlib import pyplot as plt
temperature=[
[10,8,6],
[9,7,5],
[8,7,4]
]
distance = (100,200,300)
depth = (100,300,700)
x = distance
y = depth
z = temperature
m = plt.contourf(x,y,z)
plt.gca().invert_yaxis()
plt.colorbar(m)
plt.show(m)
the trouble now that the contours seems wrong... and my question still
stands. I'd like to do the plot as said: contours + series, can you show me
where I'm wrong ?
thanks, Oz
On Wed, Jul 16, 2008 at 9:37 PM, Eric Firing <[EMAIL PROTECTED]> wrote:
> 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
>
-------------------------------------------------------------------------
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