gpt4 book ai didi

matlab - 交换图中的子图

转载 作者:太空宇宙 更新时间:2023-11-03 19:53:23 26 4
gpt4 key购买 nike

我创建了一个包含 4 个子图的图形,例如:

y = [2 2 3; 2 5 6; 2 8 9; 2 11 12];
fig = figure
for i = 1 : 4
h(i) = subplot(1,4,i)
bar(y)
end

现在我想交换子图的顺序。例如,第一个子图应该放在最后一列(第 4 列),第二个子图应该与第三个子图交换。

不重新生成图形是否可行?

最佳答案

也许您可以更改轴h'position'。例如:

% get position
pos = get(h,'position');
% change position, 1st <-> 4th, 2nd <->3rd.
set(h(1),'position',pos{4});
set(h(4),'position',pos{1});
set(h(2),'position',pos{3});
set(h(3),'position',pos{2});

关于matlab - 交换图中的子图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33034391/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com