-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinset.m
25 lines (22 loc) · 874 Bytes
/
inset.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function [h_main, h_inset]=inset(main_handle, inset_handle,inset_size)
% The function plotting figure inside figure (main and inset) from 2 existing figures.
% inset_size is the fraction of inset-figure size, default value is 0.35
% The outputs are the axes-handles of both.
%
% An examle can found in the file: inset_example.m
%
% Moshe Lindner, August 2010 (C).
if nargin==2
inset_size=0.35;
end
inset_size=inset_size*.9;
figure
new_fig=gcf;
main_fig = findobj(main_handle,'Type','axes');
h_main = copyobj(main_fig,new_fig);
%set(h_main,'Position',get(main_fig,'Position'))
inset_fig = findobj(inset_handle,'Type','axes');
h_inset = copyobj(inset_fig,new_fig);
ax=get(main_fig,'Position');
%set(h_inset,'Position', [.75*ax(1)+ax(3)-inset_size .5*ax(2)+0.7*ax(4)-inset_size inset_size inset_size])
set(h_inset,'Position', [0.5 0.5 0.4 0.4])