matplotlib/matplotlib — Issue #666: griddata uniformity check needs tweaking
Author: ivanov
Created: 2012-01-10 22:49:10+00:00
State: open

as reported by Ethan Swint to the mpl-users mailing list:

I was working off of the example listed at
http://matplotlib.sourceforge.net/examples/pylab_examples/griddata_demo.html,
adapting it to my own data, and encountered the following error on MLAB
1.1.0, Python 2.7.2:

from numpy.random import uniform, seed
from matplotlib.mlab import griddata
import matplotlib.pyplot as plt
import numpy as np
# make up data.
#npts = int(raw_input('enter # of random points to plot:'))
seed(0)
npts = 200
x = uniform(-2,2,npts)
y = uniform(-2,2,npts)
z = x*np.exp(-x**2-y**2)
xi = np.linspace(0,60,100) # <= my xdata range
yi = np.linspace(0,0.9,200) # <= my ydata range
zi = griddata(x,y,z,xi,yi,interp='linear')

which produces
------------------------------------------------------------
ValueError Traceback (most recent call last)
C:\Users\Ethan\code\PythonScripts\ in
()
----> 1 zi = griddata(x,y,z,xi,yi,interp='linear')