python - PyLab contourf with experimental data -
i'm trying understand , adapt following code:
import numpy np def f(x,y): return (1 - x / 2 + x**5 + y**3) * np.exp(-x**2 -y**2) n = 256 x = np.linspace(-3, 3, n) y = np.linspace(-3, 3, n) x,y = np.meshgrid(x, y) pl.axes([0.025, 0.025, 0.95, 0.95]) pl.contourf(x, y, f(x, y), 8, alpha=.75, cmap=pl.cm.hot) c = pl.contour(x, y, f(x, y), 8, colors='black', linewidth=.5) pl.clabel(c, inline=1, fontsize=10) pl.xticks(()) pl.yticks(()) pl.show()
here have set of points (x,y)
, value each point, computed f(x,y)
now, have set of computational results in form of x;y;output
in txt output file read csv
module example. point i'm not understanding data types here, meshgrid. let's each point key key
in dictionary fh_dict
fh_dict[key]
play role of f(x,y)
in code above. don't know how implement it, output value each point not easy express mathematical function.
thanks time.
Comments
Post a Comment