-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcorelabel.m
105 lines (95 loc) · 2.82 KB
/
corelabel.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
function [h,corelat,corelon] = corelabel(corename,varargin)
% CORELABEL labels Antarctic ice core locations on a map. Names and
% locations are given by the 231 ice core locationslisted by iceREADER.
% (http://www.icereader.org/icereader/listData.jsp)
%
% Requires Matlab's Mapping Toolbox.
%
%% Citing Antarctic Mapping Tools
% This function was developed for Antarctic Mapping Tools for Matlab (AMT). If AMT is useful for you,
% please cite our paper:
%
% Greene, C. A., Gwyther, D. E., & Blankenship, D. D. Antarctic Mapping Tools for Matlab.
% Computers & Geosciences. 104 (2017) pp.151-157.
% http://dx.doi.org/10.1016/j.cageo.2016.08.003
%
% @article{amt,
% title={{Antarctic Mapping Tools for \textsc{Matlab}}},
% author={Greene, Chad A and Gwyther, David E and Blankenship, Donald D},
% journal={Computers \& Geosciences},
% year={2017},
% volume={104},
% pages={151--157},
% publisher={Elsevier},
% doi={10.1016/j.cageo.2016.08.003},
% url={http://www.sciencedirect.com/science/article/pii/S0098300416302163}
% }
%
%% Syntax
%
% corelabel('CoreName')
% corelabel('CoreName','TextProperty',PropertyValue)
% corelabel('CoreName','Marker','MarkerStyle')
% h = corelabel(...)
% [h,corelat,corelon] = corelabel(...)
%
%
%% Description
%
% corelabel('CoreName') labels an ice core location if a map is current.
%
% corelabel('CoreName','TextProperty',PropertyValue) formats the label with
% text properties as name-value pairs.
%
% corelabel('CoreName','Marker','MarkerStyle') places a marker at the
% center location.
%
% h = corelabel(...) returns the handle h of the label.
%
% [h,corelat,corelon] = corelabel(...) returns geographic coordinates of
% the ice core.
%
%
%% Example: Label a couple of ice core locations:
%
% load coast
% antmap
% patchm(lat,long,'y')
%
% corelabel('Vostok')
% corelabel('Dome C','color','b','marker','b*')
% corelabel('byrd','rotation',45,'fontangle','italic')
%
%
%% Author Info
% Created by Chad A. Greene, October 2013.
% The University of Texas Institute for Geophysics.
%
% See also textm, scarclick, scarlabel, coreloc, scarloc, and antmap.
%% Get location:
[corelat,corelon] = coreloc(corename);
%% Place text label:
% Apply the text label:
h = textm(corelat,corelon,corename,'horizontalalignment','center');
%% Place a marker if requested:
tmp = strcmpi(varargin,'marker');
if any(tmp)
h(2) = plotm(corelat,corelon,varargin{find(tmp)+1});
varargin{find(tmp)+1}=1;
varargin = varargin(~tmp);
set(h(1),'VerticalAlignment','bottom');
end
%% Format text and marker
% This is brute force, but it works:
for k = 1:length(h)
for k2 = 1:length(varargin)
try
set(h(k),varargin{k2},varargin{k2+1});
end
end
end
%% Clean up:
% Delete output arguments if none are requested:
if nargout==0
clear h corelat corelon
end