0

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()

enter image description here

If I use ax.set_xticks([]) for all axes I get

enter image description here

I still want to keep the lines in the plot and only remove the axis values.

1

1 Answer 1

2

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([])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.