forked from csdms-contrib/slepian_alpha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cbarticks.m
37 lines (32 loc) · 841 Bytes
/
cbarticks.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
26
27
28
29
30
31
32
33
34
35
function cbarticks(cb,cax,tint,pos)
% CBARTICKS(cb,cax,tint,pos)
%
% Transforms the tick marks and labels to agree with
% what's plotted in the figure.
%
% INPUT:
%
% cb Handle to the colorbar
% cax Minimum and maximum of the color range
% tint Tick interval
% pos 'hor' or 'vert'
%
% SEE ALSO:
%
% ADDCB, IMAGEF, IMAGEFDIR, IMAGEFNAN
%
% Last modified by fjsimons-at-alum.mit.edu, 06/19/2008
% Last modified by charig-at-princeton.edu, 02/05/2016
defval('tint',20)
defval('pos','hor')
% Make sure the last one makes it regardless of tint
tix=unique([cax(1):tint:cax(2) cax(2)]);
if strcmp(pos,'hor')
set(cb,'Xtick',scale(tix,get(cb,'xlim')))
set(cb,'XtickLabel',tix)
elseif strcmp(pos,'vert')
set(cb,'Ytick',scale(tix,get(cb,'ylim')))
set(cb,'YtickLabel',tix)
else
error('Specify valid orientation')
end