有没有办法在plotmatrix函数的图形之间添加一些空间?(我想给每个x和y轴贴上标签)
发布于 2015-04-14 22:14:19
您可以在对plotmatrix的调用中使用特定的输出参数来实现这一点。然后,您可以检索每个轴的位置并对其进行修改(使其变小)。
示例:
clc
clear
rng default
X = randn(50,3);
Y = reshape(1:150,50,3);
%// Use this output argument
[~,AX,~,~,~] = plotmatrix(X,Y);
%// Fetch all the positions and alter them (make axes smaller)
AllPos = get(AX(:),'Position');
AllPos = vertcat(AllPos{:});
NewPos = [AllPos(:,1)+.05 AllPos(:,2)+.05 AllPos(:,3)-.1 AllPos(:,4)-.1]
%// Update the plot
for k = 1:numel(AX)
axes(AX(k))
set(AX(k),'Position',NewPos(k,:))
xlabel(sprintf('Axes %i',k))
end产出如下:

与原来的情节相反:

https://stackoverflow.com/questions/29462043
复制相似问题