Matplotlib–Python三维绘图(1)–创建三维轴坐标对象

发布于 2022-10-06  770 次阅读


Please refresh the page if equations are not rendered correctly.
---------------------------------------------------------------

一.创建三维轴坐标对象

from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

1. 利用关键字projection='3d'实现

#定义坐标轴

fig = plt.figure()
ax1 = plt.axes(projection='3d')

或者

fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')  #画多个子图

2. from mpl_toolkits.mplot3d import Axes3D

fig=plt.figure()
ax2 = Axes3D(fig)
Everything not saved will be lost.
最后更新于 2022-10-06