Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 增加三维Matplotlib中标签和轴标签之间的间距_Python_Matplotlib_Plot_Axis Labels - Fatal编程技术网

Python 增加三维Matplotlib中标签和轴标签之间的间距

Python 增加三维Matplotlib中标签和轴标签之间的间距,python,matplotlib,plot,axis-labels,Python,Matplotlib,Plot,Axis Labels,我以前见过类似的问题,但答案似乎只适用于2D绘图 我增加了ticklabels和axis标签的字体大小,以使绘图更具可读性,但现在这两个标签重叠了。以下是我的代码的相关部分: import matplotlib.pyplot as plt fig = plt.figure() ax = fig.gca(projection = '3d') plt.rc('text', usetex=True) plt.rc('font', family='serif') for label in ax.g

我以前见过类似的问题,但答案似乎只适用于2D绘图

我增加了ticklabels和axis标签的字体大小,以使绘图更具可读性,但现在这两个标签重叠了。以下是我的代码的相关部分:

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection = '3d')

plt.rc('text', usetex=True)
plt.rc('font', family='serif')

for label in ax.get_xticklabels() + ax.get_yticklabels() + ax.get_zticklabels():
    label.set_fontsize(16)

ax.set_xlabel('Applied Field (mT)', fontsize = 20, labelpad=30)
ax.set_ylabel('Temperature (K)', fontsize = 20, labelpad=30)
ax.set_zlabel('$M / M_s$', fontsize = 20, labelpad=30)
我尝试在序言之后立即放置
plt.rcParams['xtick.major.pad']=12
,但这似乎没有任何效果,而且它没有z轴选项

ax.set_label()
中的选项
labelpad=
似乎对标签和轴标签之间的距离没有影响

我做错什么了吗

编辑:我不想问我是否做错了什么,而是想问是否有一种在3D中做这件事的方法


谢谢。

labelpad
参数当前在
3D
中没有任何内容。文件上确实是这么说的。@CTZhu那么有什么办法可以让我做我想做的吗?@user3087409你找到什么办法来增加xticklabel和lable之间的差距了吗?