matplotlib绘制3维曲面图

import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['SimHei']
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
x = np.arange(1,10,0.2)
y = np.arange(1,10,0.2)
#产生隔点矩阵
x,y = np.meshgrid(x,y)
z = 2*x**2 + y + 1
ax.plot_surface(x,y,z)
plt.show()

你可能感兴趣的:(matplotlib绘制3维曲面图)