Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Python by (19.9k points)

Consider the following picture. How do I create distance between the x-axis numbering and the label?

enter image description here

The plot is created following the steps.

The structure of the code is more or less like this:

import matplotlib.pyplot as plt

from mpl_toolkits import mplot3d; 

ax = plt.axes(projection='3d')

ax.plot_surface(X, Y, Z, rstride=1, cstride=1,

               cmap='viridis')

ax.set_title('surface');

1 Answer

0 votes
by (25.1k points)
edited by

You can create distance between the x-axis by specifying the label pad argument to a value in the set_xlabel method. You can do this for any axis (x, y, z) etc.

ax.set_xlabel('xxxxxxxxx', labelpad=10)

To know more about this you can have a look at the following video:-

Related questions

0 votes
1 answer
asked Nov 30, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer

Browse Categories

...