参考文章:
参考文章一
以下是实现代码
from matplotlib import pyplot as plt
import numpy as np
import mpl_toolkits.mplot3d
#先生成二维图
fig = plt.figure()
#再转化为三维
ax = mpl_toolkits.mplot3d.Axes3D(fig)
x = np.linspace(-10,10,num=50)
y = np.linspace(-10,10,num=20)
# 生成网格矩阵
x,y = np.meshgrid(x, y)
R1 = -2 * x + -5 * y + 15
R2 = (3*x - 4*y - 1) / 5
R3 = (-5*x - 3*y + 10) / 2
ax.plot_surface(x, y, R1,alpha=0.5,color='b')
ax.plot_surface(x, y, R2,alpha=0.5,color='r')
ax.plot_surface(x, y, R3,alpha=0.5,color='g')
ax.scatter(1,3,-2,c='black',s=40)
# 添加记号
ax.text(1,3,-2,"answer")
plt.show()