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

Last change on this file since 6860 was 6860, checked in by Mathieu Morlighem, 14 years ago

deleted all global variables. If ISSM_DIR is needed, call issmdir() routine. This makes everything easier: no more clearall

File size: 1.2 KB
Line 
1function showregion(md,insetpos)
2%SHOWREGION - show region on plot
3%
4% Usage:
5% showregion(md,insetpos);
6
7%get inset relative position (x,y,width,height)
8%insetpos=getfieldvalue(options,'insetpos',[0.02 0.70 0.18 0.18]);
9
10%get current plos position
11cplotpos=get(gca,'pos');
12%compute inset position
13PosInset=[cplotpos(1)+insetpos(1)*cplotpos(3),cplotpos(2)+insetpos(2)*cplotpos(4), insetpos(3)*cplotpos(3), insetpos(4)*cplotpos(4)];
14axes('pos',PosInset);
15axis equal off
16%box off
17if strcmpi(md.hemisphere,'n') | strcmpi(md.hemisphere,'north'),
18 A=expread([issmdir() 'projects/Exp/Greenland.exp']);
19elseif strcmpi(md.hemisphere,'s') | strcmpi(md.hemisphere,'south'),
20 A=expread([issmdir() '/projects/Exp/Antarctica.exp']);
21else
22 error('applyoptions error message: hemisphere not defined');
23end
24
25Ax=[min(A.x) max(A.x)];
26Ay=[min(A.y) max(A.y)];
27
28mdx=[min(md.x) max(md.x)];
29mdy=[min(md.y) max(md.y)];
30
31line(A.x,A.y,'color','b');
32patch([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')
33patch( [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)
34colorbar('off');
Note: See TracBrowser for help on using the repository browser.