source: issm/oecreview/Archive/24307-24683/ISSM-24436-24437.diff@ 24684

Last change on this file since 24684 was 24684, checked in by Mathieu Morlighem, 5 years ago

CHG: added new review

File size: 1.1 KB
RevLine 
[24684]1Index: ../trunk-jpl/src/m/plot/legendd.m
2===================================================================
3--- ../trunk-jpl/src/m/plot/legendd.m (nonexistent)
4+++ ../trunk-jpl/src/m/plot/legendd.m (revision 24437)
5@@ -0,0 +1,27 @@
6+function legendd(varargin)
7+
8+ options=pairoptions(varargin{:});
9+
10+ %retrieve arguments:
11+ x=getfieldvalue(options,'x',0);
12+ y=getfieldvalue(options,'y',0);
13+ w=getfieldvalue(options,'w',1);
14+ h=getfieldvalue(options,'h',1);
15+ facecolor=getfieldvalue(options,'FaceColor','w');
16+ edgecolor=getfieldvalue(options,'EdgeColor','k');
17+ strings=getfieldvalue(options,'strings',{});
18+ colors=getfieldvalue(options,'colors',{});
19+ fontsize=getfieldvalue(options,'FontSize',12);
20+ linewidth=getfieldvalue(options,'LineWidth',2);
21+
22+ hold on;
23+ rectangle('Position',[x,y,w,h],'FaceColor',facecolor,'EdgeColor',edgecolor);
24+
25+ nl=length(strings);
26+ for i=1:nl,
27+ l=line([x+w/6 x+w/3],[y+(nl+1-i)*h/(nl+1) y+(nl+1-i)*h/(nl+1)]);
28+ set(l,'Color',colors{i});
29+ set(l,'LineWidth',linewidth);
30+ text(x+1.3*w/3,y+(nl+1-i)*h/(nl+1),strings{i},'FontSize',fontsize);
31+ end
32+
Note: See TracBrowser for help on using the repository browser.