Python 在三维打印的另一侧移动z轴

Python 在三维打印的另一侧移动z轴,python,matplotlib,Python,Matplotlib,如何在另一侧移动三维打印的z轴(包括标签、记号和编号)。下面是我的意思的小代码和图: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d fig = plt.figure() ax = Axes3D(fig) ax.set_xlabel("X" , fontsize=20) ax.set_ylabel("Y", fontsize=20) ax.set_zlabel("Z" , fontsize=20

如何在另一侧移动三维打印的z轴(包括标签、记号和编号)。下面是我的意思的小代码和图:

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

fig = plt.figure()
ax = Axes3D(fig)

ax.set_xlabel("X" , fontsize=20)
ax.set_ylabel("Y", fontsize=20)
ax.set_zlabel("Z" , fontsize=20)

x = np.arange(0,10,0.01)
y = np.ones(len(x))
z = np.sin(x)
plt.plot(x,y,z)
一种可能的解决方案:

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


fig = plt.figure()
ax = Axes3D(fig)

tmp_planes = ax.zaxis._PLANES 
ax.zaxis._PLANES = ( tmp_planes[2], tmp_planes[3], 
                     tmp_planes[0], tmp_planes[1], 
                     tmp_planes[4], tmp_planes[5])
ax.set_xlabel("X" , fontsize=20)
ax.set_ylabel("Y", fontsize=20)
# rotate label
ax.zaxis.set_rotate_label(False)  # disable automatic rotation
ax.set_zlabel("Z axis label" , fontsize=20, rotation=90)
x = np.arange(0,10,0.01)
y = np.ones(len(x))
z = np.sin(x)
plt.plot(x,y,z)

谢谢您的回复!实际上,我不想改变绘制的东西的方向(实际的东西要复杂得多,所以方向很重要)。我只想在另一边标注z-azis。我编辑了我的答案。这不是最好的方法,但它确实有效…非常感谢!这几乎做到了!有没有办法把Z标签颠倒过来。如果你写的不是Z,而是一个真实的单词,我希望它是从下到上读的,而不是从上到下读的。你可以简单地旋转标签:)我编辑了我的答案,如果有帮助请接受:)太棒了!谢谢!