default size figures with subplot
15 次查看(过去 30 天)
显示 更早的评论
I would like to combine couple or three figures into a single window but when I use subplot(2,1,1) and subplot(2,1,2) I get two long ones or subplot(1,2,1) and subplot(1,2,2) I get two tall ones. I just want two figures side by side with their default size.
Is that possible? if so, how ? :D
Thanks
0 个评论
采纳的回答
Joseph Cheng
2015-5-19
yeah very simple.
hfig = figure;
pos = get(hfig,'position')
set(hfig,'position',pos.*[.5 1 2 1])
subplot(1,2,1),plot(randi(10,10,2))
subplot(1,2,2),plot(randi(10,10,2))
2 个评论
Joseph Cheng
2015-5-19
well some additional playing around with it like
numplots = 4;
hfig = figure;
pos = get(hfig,'position')
set(hfig,'position',pos.*[0 1 numplots 1])
for ind = 1:numplots
subplot(1,numplots,ind),plot(randi(10,10,2))
end
does show there is some width modifications to the width of each axes, especially the more you put in. However the heights are the same. You can play around with the set() command for both the figure handle and axes handles to change their positioning if this slight change from the default size is an issue.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!