1

Hey I cannot figure out any solution to solve my problem. The first tick labels keep overlapping. I found some methods to pad the tick label, but they did not work for a 3D plot. Is there any way to solve this? enter image description here

1
  • You can try to enhancing the figure size by fig = plt.figure(figsize = (xx,xx)). Maybe this could help. Commented Apr 3, 2016 at 13:18

1 Answer 1

1

You can directly position and give the tick labels. If you are short on size consider setting the ticks yourself (alignment, position, names, font size, etc.). The following example does this for the Y axis tick labels:

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

fig = plt.figure(figsize=(10,10))
ax = fig.gca(projection='3d')

x,y,z = np.random.randint(0,100,30),np.random.randint(0,100,30),np.random.randint(0,100,30)
ax.scatter(x,y,z)

ax.set_xlabel('X')
ax.set_xlim3d(0, 100)
ax.set_ylabel('Y')
ax.set_ylim3d(0, 100)
ax.set_yticks([30,60,90])
ax.set_yticklabels(['number 30','number 60','number 90'], va='center', ha='left',fontsize=24)
ax.set_zlabel('Z')
ax.set_zlim3d(0, 100)

plt.show()

, this results in:

Setting up tick labels in Axes3D

Obviously you'll need to see what works for the figure size you want and the values you want to be shown in your plot.

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.