1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt import math
fig = plt.figure()
ax = Axes3D(fig)
x = np.linspace(-10,10,100)
y = np.linspace(-10,10,100)
x,y = np.meshgrid(x,y)
r = x**2+y**2-math.sqrt(2)*x*y
ax.plot_surface(x,y,r,rstride = 1, cstride = 1,cmap='rainbow')
plt.savefig('minus.tif', dpi=200) plt.show()
|