如何在3d图中设置刻度线并确定哪个(我的意思是x,y或z轴)?
我不能使用法线轴,因为我不知道如何将法线轴向后设置并在其前面绘制。
在2d图中,我找到了https://scipython.com/blog/adding-ticks-to-a-matplotlib-line/。你知道类似的东西吗?
import numpy as np
import matplotlib.pyplot as plt
from numpy import array
from scipy.interpolate import RegularGridInterpolator
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D # 3d graph
from mpl_toolkits.mplot3d import proj3d # 3d graph
fig = plt.figure(figsize=[10,6])
# Axes
ax = fig.gca(projection = '3d')
ax.azim = 51 # y rotation (default=270)
ax.elev = 21 # x rotation (default=0)
# Remove fill
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
# Axes - range
ax.set_xlim(-1.5e-14,0e-14)
ax.set_ylim(-7.3e-15,7.3e-15)
ax.set_zlim(0e-13,1.2e-13)
# Hide axis
ax._axis3don = False
# Plot axis
# x
axx=ax.plot([0.05e-14,-1.25e-14],
[-6.3e-15, -6.3e-15],
[0, 0])
# y
axy=ax.plot([-1.255e-14, -1.255e-14],
[-6.4e-15, 7.6e-15],
[0e-15, 0e-15])
# z
ayz=ax.plot([-1.25e-14, -1.25e-14],
[-6.3e-15, -6.3e-15],
[0e-14, 1.22e-13])
x_arrowy = [-1.28e-14]
y_arrowy = [7.39e-15]
z_arrowy = [-1.41e-15]
x_arrowz = [-1.253e-14]
y_arrowz = [-6.37e-15]
z_arrowz = [1.21e-13]
x_arrowx = [0e-16]
y_arrowx = [-7.1e-15]
z_arrowx = [-3.91e-15]
ax.scatter(x_arrowy, y_arrowy, z_arrowy, marker=(3, 0, 10), s=100)
ax.scatter(x_arrowz, y_arrowz, z_arrowz, marker=(3, 0, 0), s=100)
ax.scatter(x_arrowx, y_arrowx, z_arrowx, marker=(3, 0, 223), s=100)
plt.tight_layout()
plt.savefig('file', bbox_inches='tight')
plt.show()