简体   繁体   中英

mplot3d - How do I display minor ticks?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM