-
Notifications
You must be signed in to change notification settings - Fork 0
/
mf_tick.m
53 lines (46 loc) · 1.54 KB
/
mf_tick.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%==========================================================================
% Set the axis ticks
%
% input :
%
% output :
%
% Siqi Li, SMAST
% 2022-04-28
%
% Updates:
%
%==========================================================================
function mf_tick(ax, varargin)
varargin = read_varargin(varargin, {'TickLength'}, {[0.025 0.01]});
varargin = read_varargin(varargin, {'TickDir'}, {'out'});
varargin = read_varargin(varargin, {'XMinorTick'}, {'on'});
varargin = read_varargin(varargin, {'YMinorTick'}, {'on'});
varargin = read_varargin(varargin, {'dx'}, {nan});
varargin = read_varargin(varargin, {'dy'}, {nan});
varargin = read_varargin(varargin, {'Scale'}, {1});
set(ax, 'TickLength', TickLength*Scale)
set(ax, 'TickDir', TickDir)
% if ~contains(class(ax), 'GeographicAxes')
switch class(ax)
case 'GeographicAxes'
case 'matlab.graphics.illustration.ColorBar'
otherwise
set(ax, 'XMinorTick', XMinorTick)
set(ax, 'YMinorTick', YMinorTick)
if ~isnan(dx)
xlims = get(gca, 'xlim');
XMinorTickValues = floor(xlims(1)) : dx : ceil(xlims(2));
XAxis = get(ax, 'XAxis');
set(XAxis, 'MinorTickValues', XMinorTickValues)
end
if ~isnan(dy)
ylims = get(gca, 'ylim');
YMinorTickValues = floor(ylims(1)) : dy : ceil(ylims(2));
YAxis = get(ax, 'YAxis');
set(YAxis, 'MinorTickValues', YMinorTickValues)
end
end
if ~isempty(varargin)
set(ax, varargin{:})
end