python - 2D plot using 1D arrays without griddata() -


i trying plot function of 2 variables using matplotlib. function stored in 3 1d arrays x, y , f corresponding x-coordinate, y-coordinate , value of function. possible plot these data contour plot? before saw solution griddata(), avoid interpolating since x , y coordinates defined.

take @ the contour demo of matplotlib docs. since can calculate function f @ given point:

delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) x, y = np.meshgrid(x, y) f = your_function(x.ravel(), y.ravel()) cs = plt.contour(x, y, f.reshape(x.shape)) plt.clabel(cs, inline=1, fontsize=10) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -