How do I display (turn on) minor ticks on a 3D surface plot using mplot3d / axes3d graph?
I can define the major tickmark locations using:
ax.w_zaxis.set_major_locator(MultipleLocator(10))
Similarly, I'm guessing I can define the the minor ticks using:
ax.w_zaxis.set_minor_locator(MultipleLocator(2))
This appears to define the minor tick locators but doesn't actually turn them on in my plot. How do I turn the minorticks on in my axes3D?
From what I can tell, minor tick marks aren't fully implemented in mplot3d. The place I'm looking at in the matplotlib code is Your_Python_Lib_site-packages\mpl_toolkits\mplot3d\axis3d.py
in the draw()
function. I see only the code to draw the major tick marks, not the minor ones. It seems like it wouldn't be all that hard to modify the code to make it draw the minor tick marks too. I wonder if the matplotlib people even know that the minor tick marks don't work in mplot3d.
As of v3.3 this can be done by setting minor=True
in:
ax.set_xticks(minor=True)
ax.set_yticks(minor=True)
ax.set_zticks(minor=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With