Python 3.x 如何在python3中绘制simle 3d轴?

Python 3.x 如何在python3中绘制simle 3d轴?,python-3.x,matplotlib,Python 3.x,Matplotlib,我希望轴的名称如图所示。这可能是一个很好的开端。试着用它做实验 import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np fig = plt.figure(figsize=[8,8]) ax = fig.gca(projection = '3d') # some settings vleng = 4 aleng = vleng/3. p = np.array([vle


我希望轴的名称如图所示。

这可能是一个很好的开端。试着用它做实验

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

fig = plt.figure(figsize=[8,8])
ax = fig.gca(projection = '3d')

# some settings
vleng = 4
aleng = vleng/3.

p = np.array([vleng, 0, 0])
q = np.array([0, vleng, 0])
r = np.array([0, 0, vleng])

ax.plot(*np.vstack([[0,0,0], p]).T, color='b')
ax.plot(*np.vstack([[0,0,0], q]).T, color='g')
ax.plot(*np.vstack([[0,0,0], r]).T, color='r')

# plotting arrow at terminal of the lines
ax.quiver(vleng, 0, 0, aleng, 0, 0,  \
          length=0.5, arrow_length_ratio=0.5, color='r')
ax.quiver(0, vleng, 0, 0, aleng, 0, \
          length=0.5, arrow_length_ratio=0.5, color='m')
ax.quiver(0, 0, vleng, 0, 0, aleng, \
          length=0.5, arrow_length_ratio=0.5, color='k')

ax.text3D(vleng+1.5, 0, 0, 'X')
ax.text3D(0, vleng+1.0, 0, 'y')
ax.text3D(0, 0, vleng+1.0, 'z')

ax.azim = 35    # y rotation (default=270)
ax.elev = 20    # x rotation (default=0)
ax.dist = 15    # zoom (define perspective)

ax.set_axis_off( )  # hide all grid
ax.set_aspect('equal')

# plot poly1
ax.plot3D( [3.5, 0.25, 2, 3.5], [1, 0.25, 2.5, 1], [1.9, 3.2, 3.8, 1.9], label = 'one line', color='pink' )
# projection of poly1 on xy-plane
ax.plot3D( [3.5, 0.25, 2, 3.5], [1, 0.25, 2.5, 1], [0, 0, 0, 0], label = 'one line', color='gray' )
#ax.legend()

plt.show()

您真的需要3d或类似3d绘图的东西吗。i、 三条线段。我真的需要3d轴,然后我会画更多的进去谢谢。我得到了这个错误:`“当前无法手动设置方面”未实现错误:当前无法在三维轴上手动设置方面`请问这是什么意思?三维轴不允许设置方面。这就是错误告诉你的。