Hi, I am trying to use griddata to interpolate some irregularly spaced data
onto a linspace-created mesh in order to get a temperature plot.

I've been able to follow this example and it's worked perfectly for me:
http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html

However, when I do my own data I get an error message that says:

>
> Traceback (most recent call last):
>   File "make_colormap.py", line 248, in <module>
>     zi=griddata(x,y,z,xi,yi,interp='linear')
>   File "/usr/lib/pymodules/python2.6/matplotlib/mlab.py", line 2579, in
> griddata
>     raise ValueError("output grid must have constant spacing"
> ValueError: output grid must have constant spacing when using
> interp='linear'


Looking into the documentation it seems that this is just suggesting that
the xi,yi grids to be interpolated on have constant spacing. I don't know
if this is supposed to be the SAME constant spacing in xi and yi, but it
appears not to be, since the example above uses the line:

xi = np.linspace(-2.1,2.1,100)
> yi = np.linspace(-2.1,2.1,200)


so one is twice as fine as the other.

However, my code, when I do something like



> xi=linspace(-20.1,20.1,100)
> yi=linspace(-20.1,20.1,200)
> zi=griddata(x,y,z,xi,yi,interp='linear')
> CS=plt.contourf(xi,yi,zi,15,cmap=plt.cm.jet)


it gives me the above error complaining about "constant spacing".

Anyone have an idea what I might be missing here? I can turn interp to 'nn'
and the code works fine, but I'm just curious what about a "constant
spaced" output grid I don't understand. Is it even possible to create a
non-constant spaced output grid with linspace?

Thanks for the help!

Brad
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to