Search code examples
pythonmatplotlibmatplotlib-3d

Adjust the distance between zticks and Z axis in the 3D plot


The zticks and Z axis are overlapping in a 3D plot. How to adjust the spacing between these two? I think this is happening because of the because of more number digits after the decimal point.

enter image description here


Solution

  • Using the solution suggested by @r-beginners along with axes.set_zticks solved the problem i.e., according to matplotlib.axes.Axes.set_xticklabels documentation the following code should be used for fixing the zticks position:

    ax.set_zticks(ticks,  minor=False)
    

    Later use the following code to offset the zticks:

    ax.set_zticklabels(ax.get_zticks(), fontdict={'ha':'left'})