example for Pavel

157 days ago by ondrej

# Begin from mpl_toolkits.mplot3d import Axes3D from pylab import figure, savefig import numpy as np from numpy import zeros, sin from matplotlib import cm fig = figure() ax = Axes3D(fig) n = 10 X, Y = np.mgrid[:n, :n] m = zeros((n, n), dtype="float") # getting values at Cartesian grid points # (this will be done by the numerical method) for i in range(n): for j in range(n): m[i][j] = sin(i)*sin(j) # putting them into the array Z for plotting Z = m # plotting ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) savefig("surface1.png") # End