How can I put existing figures in different subplots in another figure in MATLAB 6.5 (R13)?
436 ビュー (過去 30 日間)
The ability to make subplots from a set of figures interactively has been incorporated in MATLAB 7.2 (R2006a) using 'Plot Tools'. To do this, perform the following steps:
1. Plot a figure.
2. Click on the white icon, "Show Plot Tools and dock figure", on the top of the figure.
3. Select all objects by pressing CTRL-A
4. Copy the objects by pressing CTRL-C
5. Open a new figure window in Plot Tools by clicking on the white icon, "New Figure" on the left.
6. Paste the objects by pressing CTRL-V
7. Repeat the steps 1-4 for the other figures you want to copy and paste them into the final figure.
The sub-plots in the final figure can now be resized and moved as desired.
To work around this issue in previous releases, read the following:
The COPYOBJ function will allow you to copy objects between parent objects. In order to copy several sets of axes into a subplot, you will need to use two steps:
1. Copy the contents of your original figure into your destination figure.
2. Modify the position properties of the axes so that they match a subplot's position. Following is an example code which should help you to set the position property. This code is designed only to work with a 4-by-1 set of subplots. You may need to modify the code to work with your data.
% First, create 4 figures with four different graphs (each with a
% Now create destination graph
ax = zeros(4,1);
for i = 1:4
% Now copy contents of each figure over to destination figure
% Modify position of each axes as it is transferred
for i = 1:4
h = get(gcf,'Children');
newh = copyobj(h,5)
for j = 1:length(newh)
posnewh = get(newh(j),'Position');
possub = get(ax(i),'Position');
[posnewh(1) possub(2) posnewh(3) possub(4)])
その他の回答 (1 件)
Eric Sargent 2020 年 12 月 9 日
Starting in R2019b, you can use tiledlayout to manage several axes. You can reparent each of your axes into a layout, and set the tile number of each axes as appropriate.
% Get a list of all of the open figures
for i = 1:numel(figlist)