使用subplot(row, col, i)
创建的子图,matlab会隐式地调整它们的间距以及它们和整个figure的边距,以达到它所认为的美观或者合理的设置,然而如果我们想根据需求设置合理的间距以及边距,该怎么定制呢?
这里提供一个函数(是在没必要把时间花费在这种繁琐的格式上):
function ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)% tight_subplot creates "subplot" axes with adjustable gaps and margins%% ha = tight_subplot(Nh, Nw, gap, marg_h, marg_w)%% in: Nh number of axes in hight (vertical direction)% Nw number of axes in width (horizontaldirection)% gap gaps between the axes in normalized units (0...1)% or [gap_h gap_w] for different gaps in height and width % marg_h margins in height in normalized units (0...1)% or [lower upper] for different lower and upper margins % marg_w margins in width in normalized units (0...1)%