python绘图子图间距调整:subplots_adjust

python绘图子图间距调整:subplots_adjust

官网注释

我是个初学者,个人认为不懂的可以先看看官网的文档,再去百度什么的,理解别人的代码。
链接:https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplots_adjust.html?highlight=subplots_adjust

matplotlib.pyplot.subplots_adjust(函数名

matplotlib.pyplot.subplots_adjust(left=None, bottom=None, right=None,
top=None, wspace=None, hspace=None)
(前四个含义——单独子图的参数调整:左、下、右、上预留距离,默认为无。)
(后两个含义——子图之间的参数调整:横向间隔距离、纵向间隔距离)

Adjust the subplot layoutparameters.(用途:子图布局参数调整

Unset parameters are left unmodified;
initial values are given by rcParams[“figure.subplot.[name]”].
(未设置的参数保持不变;初始值由 给出 rcParams[“figure.subplot.[name]”]。)
这里涉及到 rcParams的设置,我也不太懂,可以设置字体语言和样式这些,比如:

plt.rcParams[‘font.sans-serif’] =[‘Microsoft YaHei’]
plt.rcParams[‘axes.unicode_minus’] = False)

参数的官网解释
1.Parameters leftfloat, optional The position of the left edge of the subplots, as a fraction of the figure width.
(左:浮点数,可选子图左边缘的位置,作为图形宽度的一部分。)
2. rightfloat, optional The position of the right edge of the subplots, as a fraction of the figure width.
(右:浮点数,可选子图右边缘的位置,作为图形宽度的一部分。)
3. bottomfloat, optional The position of the bottom edge of the subplots, as a fraction of the figure height.
(底部:浮点数,可选子图底部边缘的位置,作为图形高度的一部分。)
4. topfloat, optional The position of the top edge of the subplots, as a fraction of the figure height.
(顶部:浮点数,可选子图上边缘的位置,作为图形高度的一部分。)
5.wspacefloat, optional The width of the padding between subplots, as a fraction of the average Axes width.
(wspace:浮点数,可选子图之间的填充宽度,作为平均轴宽度的一部分。)
6.hspacefloat, optional The height of the padding between subplots, as a fraction of the average Axes height.
(hspace:浮点数,可选子图之间的填充高度,作为平均轴高度的一部分。)

来源:风切雨落

物联沃分享整理
物联沃-IOTWORD物联网 » python绘图子图间距调整:subplots_adjust

发表评论