12

I have some mpl_toolkits.mplot3d surface plots that I am viewing from different angles. When viewed from directly above (elev = 90, azim = 90) the text of the z-axis is all piled up on top of itself.

ax.set_axis_off() hides all of the axes, but I want to hide or turn off the z-axis but still see the x and y axes.

How can I do it?

user
  • 4,960
  • 7
  • 46
  • 70
user1666203
  • 121
  • 1
  • 3

2 Answers2

16

Most of the features are accessible via w_zaxis:

In this case you can use:

ax.w_zaxis.line.set_lw(0.)
ax.set_zticks([])
TheIdealis
  • 595
  • 4
  • 11
  • I was trying to do something to Z axis using `ax.get_zaxis()` and was getting an error that there is no such method. I substituted `get_zaxis()` with `w_zaxis` - it worked. But recently I'm using `zaxis` field that does the same job but is shorter. – mbdevpl Sep 10 '16 at 10:37
4

Though this question was posted a long time ago, I did not find a good solution for this. I tried it myself then found this code below might work:

ax.set_zticks([])
Ivan
  • 24,563
  • 6
  • 44
  • 76
Icoding
  • 41
  • 1