source: issm/trunk/src/m/model/plot/showregion.m@ 6367

Last change on this file since 6367 was 6367, checked in by Eric.Larour, 14 years ago

New showregion routine, usable directly in plots.

File size: 1.1 KB
RevLine 
[6367]1function showregion(md,insetpos)
2global ISSM_DIR
3
4%get inset relative position (x,y,width,height)
5%insetpos=getfieldvalue(options,'insetpos',[0.02 0.70 0.18 0.18]);
6
7%get current plos position
8cplotpos=get(gca,'pos');
9%compute inset position
10PosInset=[cplotpos(1)+insetpos(1)*cplotpos(3),cplotpos(2)+insetpos(2)*cplotpos(4), insetpos(3)*cplotpos(3), insetpos(4)*cplotpos(4)];
11axes('pos',PosInset);
12axis equal off
13%box off
14if strcmpi(md.hemisphere,'n') | strcmpi(md.hemisphere,'north'),
15 A=expread([ ISSM_DIR 'projects/Exp/Greenland.exp']);
16elseif strcmpi(md.hemisphere,'s') | strcmpi(md.hemisphere,'south'),
17 A=expread([ ISSM_DIR '/projects/Exp/Antarctica.exp']);
18else
19 error('applyoptions error message: hemisphere not defined');
20end
21
22Ax=[min(A.x) max(A.x)];
23Ay=[min(A.y) max(A.y)];
24
25mdx=[min(md.x) max(md.x)];
26mdy=[min(md.y) max(md.y)];
27
28line(A.x,A.y,'color','b');
29patch([Ax(1) Ax(2) Ax(2) Ax(1) Ax(1)],[Ay(1) Ay(1) Ay(2) Ay(2) Ay(1)],[1 1 1],'EdgeColor',[0 0 0],'LineWidth',1,'FaceLighting','none')
30patch( [mdx(1) mdx(2) mdx(2) mdx(1)],[mdy(1) mdy(1) mdy(2) mdy(2)],ones(4,1),'EdgeColor',[0 0 0],'FaceColor','r','FaceAlpha',0.5)
31colorbar('off');
Note: See TracBrowser for help on using the repository browser.