matlab - 生成子图,然后在 MATLAB 中将它们组合成一个图形

标签 matlab plot

我的程序在命令周期中生成小图形。有没有办法只保存这些数字,然后再将它们组合成一个数字?

最佳答案

考虑代码:

hFig = figure;

%# create temporary subplots as template
for i=1:2, h(i) = subplot(2,1,i); end       %# create subplots
pos = get(h, 'Position');                   %# record their positions
delete(h)                                   %# delete them

%# load the .fig files inside the new figure
fileNames = {'a.fig' 'b.fig'};              %# saved *.fig file names
for i=1:2
    %# load fig
    hFigFile = hgload( fileNames{i} );

    %# move/copy axis from old fig to new fig
    hAx = get(hFigFile, 'Child');           %# hAx = gca;
    set(hAx, 'Parent',hFig)
    %#hAx = copyobj(hAx,hFig);

    %# resize it to match subplot position
    set(hAx, 'Position',pos{i});

    %# delete old fig
    delete(hFigFile)
end

这是改编自这个 newsgroup discussion

关于matlab - 生成子图,然后在 MATLAB 中将它们组合成一个图形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4008880/

相关文章:

matlab - 将图像转换为色度图像

r - 控制R绘图轴上的数字格式

r - 设置RGL设备的大小

python-3.x - 用 Matplotlib 绘制 SVM?

string - 忽略\n(换行符)

matlab - 一次设置多个字段/将新字段添加到单元格结构

matlab - : [M N ~] = size(imge);? 的 MATLAB 语句是什么

algorithm - 每行值的累计求和

python - Python 中的高效可视化

python - 使用 matplotlib 在单个图表上绘制两个直方图