How do I remove the axis values in a matplotlib 3d plot? A random plot:
import numpy as np
import matplotlib.pyplot as plt
ax = plt.axes(projection='3d')
a = .6
b = 1.2
zline = np.linspace(0, 15, 1000)
xline = zline*.6
yline = zline*1.2
ax.plot3D(xline, yline, zline, 'gray')
zdata = 15 * np.random.random(100)
xdata = zdata*.6 2 * np.random.randn(100)
ydata = zdata*1.2 1 * np.random.randn(100)
ax.scatter3D(xdata, ydata, zdata, c='red')
w = (1.0, 1.0, 1.0, 1.0)
ax.w_xaxis.set_pane_color(w)
ax.w_yaxis.set_pane_color(w)
ax.w_zaxis.set_pane_color(w)
plt.show()
If I use ax.set_xticks([])
for all axes I get
I still want to keep the lines in the plot and only remove the axis values.
CodePudding user response:
You can set the tick labels. Add the following lines before plt.show()
.
ax.axes.xaxis.set_ticklabels([])
ax.axes.yaxis.set_ticklabels([])
ax.axes.zaxis.set_ticklabels([])