A simple 3D grapher: line 3 is the function; a,b,c,d=domain; m, n=size; rot and tilt are viewing angles.
from math import * from matplotlib.pyplot import * def f(x,y): return x**2+y**2 a=-2 b=2 c=-2 d=2 m=8 n=8 rot=.5 tilt=1 M1=-sin(rot) M2=cos(rot) M4=-cos(rot)*cos(tilt) M5=-sin(rot)*cos(tilt) M6=sin(tilt) dx=(b-a)/m dy=(d-c)/n for s in range(n+1): X=[(a+dx*t) for t in range(m+1)] Y=[(c+dy*s) for t in range(m+1)] Z=[f(X[t],Y[t]) for t in range(m+1)] xP1=[(M1*X[i]+M2*Y[i]) for i in range(m+1)] yP1=[(M4*X[i]+M5*Y[i]+M6*Z[i]) for i in range(m+1)] plot(xP1,yP1) for t in range(m+1): X=[(a+dx*t) for s in range(n+1)] Y=[(c+dy*s) for s in range(n+1)] Z=[f(X[s],Y[s]) for s in range(n+1)] xP2=[(M1*X[i]+M2*Y[i]) for i in range(n+1)] yP2=[(M4*X[i]+M5*Y[i]+M6*Z[i]) for i in range(n+1)] plot(xP2,yP2) show()