首页 > 解决方案 > python中的3D绘图,x-ticks和标签之间的空间

问题描述

考虑下图。如何创建x 轴编号和标签之间的距离?

在此处输入图像描述

该图是按照这些步骤创建的。

代码的结构或多或少是这样的:

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');

标签: pythonmatplotlib

解决方案


You can specify a value of your choice to the labelpad argument as following. The same can be done for y and z axis labels as well.

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

推荐阅读