1 | function [h0]=colorbartype1(pos,lev,lev_pas,clip_lev,hpal,orien); |
---|
2 | |
---|
3 | % 30/10/97- NS: option "orien" pour positionner la barre verticalement |
---|
4 | % ou horizontalement--> 1 ou 0 |
---|
5 | |
---|
6 | if length(pos)>1 |
---|
7 | h0 = axes('Position',pos,'Box','on'); |
---|
8 | else |
---|
9 | h0=pos; |
---|
10 | axes(h0); |
---|
11 | set(h0,'Box','on'); |
---|
12 | end |
---|
13 | |
---|
14 | ind_lev=find( lev>=(clip_lev(1)-eps) & (lev<=clip_lev(2)+eps) ); |
---|
15 | tab_lev=[lev(ind_lev);lev(ind_lev)]; |
---|
16 | %keyboard |
---|
17 | % horizontale par defaut |
---|
18 | if (nargin < 6), orien = 0; end |
---|
19 | |
---|
20 | if orien == 0, |
---|
21 | |
---|
22 | pcolor(tab_lev); |
---|
23 | set(h0,'xticklabel', '','yticklabel',''); |
---|
24 | abs_bar=0:1/(length(ind_lev)-1):1; |
---|
25 | for j=1:lev_pas:length(ind_lev) |
---|
26 | s=num2str(lev(ind_lev(j))); |
---|
27 | text(abs_bar(j),-.5,s,'Fontsize', 9, 'HorizontalAlignment', ... |
---|
28 | 'Center', 'Units', 'normalized'); |
---|
29 | end |
---|
30 | |
---|
31 | else |
---|
32 | |
---|
33 | pcolor(tab_lev'); |
---|
34 | set(h0,'xticklabel', '','yticklabel',''); |
---|
35 | ord_bar=0:1/(length(ind_lev)-1):1; |
---|
36 | for j=1:lev_pas:length(ind_lev) |
---|
37 | s=num2str(lev(ind_lev(j))); |
---|
38 | text(1.5,ord_bar(j),s,'Fontsize', 9,'Units', 'normalized'); |
---|
39 | end |
---|
40 | |
---|
41 | end |
---|
42 | colormap(hpal); |
---|
43 | caxis(clip_lev); |
---|
44 | |
---|