0

bar3d chartI am drawing a 3d bar chart. The x and y plate is 10 * 10. However, it only displays 6 ticks in the x and y axis:

%matplotlib notebook
from mpl_toolkits.mplot3d import Axes3D  # noqa: F401 unused import


# setup the figure and axes
fig = plt.figure(figsize=(10,10))
ax1 = fig.add_subplot( projection='3d')



_x = np.arange(10)
_y = np.arange(10)
_xx, _yy = np.meshgrid(_x, _y)

x, y = _xx.ravel(), _yy.ravel()

bottom = np.zeros_like(top)
width = depth = 1

ax1.bar3d(x,y, bottom, width, depth, top, shade=True)
ax1.set_xlabel('Left cluster ID')
x_ticks =[str(i) for i in left_cluster_id]
ax1.set_xticklabels(labels=['c1','c2','c3','c4','c5','c6','c7','c8','c9','c10'])
ax1.set_ylabel('Right cluster ID')
ax1.set_yticklabels(labels = [0, 2, 3, 5, 9, 12, 13, 14, 15, 19])
ax1.set_zlabel('# of overlapping peaks')

plt.show()

How to let it display all the 10 ticks?

Ya Xiao
  • 861
  • 8
  • 16
  • Is this what you are looking for? https://stackoverflow.com/questions/24943991/change-grid-interval-and-specify-tick-labels-in-matplotlib – SKPS Jan 28 '20 at 03:01
  • Also, the variable `top` is not declared in the example. Can you post a working version? – SKPS Jan 28 '20 at 03:02

0 Answers0