/
get_target_diagram_options.m
165 lines (161 loc) · 6.81 KB
/
get_target_diagram_options.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
function [option] = get_target_diagram_options(narg,varargin)
%GET_TARGET_DIAGRAM_OPTIONS Get optional arguments for target_diagram function.
%
% [OPTION] = GET_TARGET_DIAGRAM_OPTIONS(NARG,VARARGIN)
% Retrieves the NARG optional arguments supplied to the TARGET_DIAGRAM
% function as a variable-length input argument list (VARARGIN), and
% returns the values in a OPTION data structure. Default values are
% assigned to selected optional arguments. Unassigned arguments do not
% appear in the OPTION data structure. The function will terminate
% with an error if an unrecognized optional argument is supplied.
%
% INPUTS:
% narg : number of optional arguments
% varagin : variable-length input argument list
%
% OUTPUTS:
% option : data structure containing option values. (Refer to
% display_target_diagram_options function for more information.)
% option.alpha : blending of symbol face color (0.0
% transparent through 1.0 opaque). (Default : 1.0)
% option.axismax : maximum for the Bias & uRMSD axis
% option.circleLineSpec : circle line specification (default dashed
% black, '--k')
% option.circleLineWidth : circle line width specification (default 1.5)
% option.circles : radii of circles to draw to indicate
% isopleths of standard deviation
% option.CMapZData : data values to use for color mapping of
% markers, e.g. RMSD or BIAS. (Default empty)
%
% option.colormap : 'on'/'off' switch to map color shading of
% markers to CMapZData values ('on') or min to
% max range of CMapZData values ('off').
% (Default : 'on')
% option.equalAxes : 'on'/'off' switch to set axes to be equal
% (default 'on')
% option.locationColorBar : location for the colorbar, 'NorthOutside'
% or 'EastOutside'
%
% option.markerColor : single color to use for all markers. Can be
% specified as a short name (e.g. 'r') or an RGB
% triplet (e.g. [1, 0, 0]) (Default: red)
% option.markerKey : key to use when marker labels specified as a
% map
% option.markerLabelColor: marker label color. Can be specified as a
% short name (e.g. 'k') or an RGB triplet
% (e.g. [0, 0, 0]) (Default: black)
% option.markerdisplayed : markers to use for individual experiments
% option.markerLabel : name of the experiment to use for marker
% option.markerLegend : 'on'/'off' switch to display marker legend
% (Default 'off')
% option.markerSize : marker size (Default 12)
% option.markerSymbol : marker symbol (Default 'o')
%
% option.normalized : statistics supplied are normalized with
% respect to the standard deviation of reference
% values (Default 'off')
% option.obsUncertainty : Observational Uncertainty (default of 0)
% option.overlay : 'on'/'off' switch to overlay current
% statistics on target diagram (Default 'off')
% Only markers will be displayed.
% option.ticks : define tick positions (default is that used
% by the axis function)
% option.xticklabelpos : position of the tick labels along the x-axis
% (empty by default)
% option.yticklabelpos : position of the tick labels along the y-axis
% (empty by default)
% option.titleColorBar : title for the colorbar
% Set default parameters
option.alpha = 1.0;
option.circleLineSpec = '--k';
option.circleLineWidth = get(gcf, 'defaultLineLineWidth');
option.colormap = 'on';
option.equalAxes = 'on';
option.locationColorBar = 'NorthOutside';
option.markerColor = 'r';
option.markerLabelColor = 'k';
option.markerDisplayed = 'marker';
option.markerKey = '';
option.markerLegend = 'off';
option.markerSize = 10;
option.markerSymbol = 'o';
option.normalized = 'off';
option.obsUncertainty = 0.0;
option.overlay = 'off';
% Load custom options, storing values in option data structure
for iopt = 4 : 2 : narg+3
optname = varargin{iopt};
optvalue = varargin{iopt+1};
switch lower(optname)
case 'alpha'
option.alpha = optvalue;
case 'circlelinespec'
option.circleLineSpec=optvalue;
case 'circlelinewidth'
option.circleLineWidth=optvalue;
case 'circles'
option.circles=optvalue;
case 'colormap'
option.colormap=optvalue;
case 'cmapzdata'
option.cmapzdata = optvalue;
if isa(option.cmapzdata,'char')
error('CMapZdata cannot be a char!');
end
case 'equalaxes'
option.equalAxes=optvalue;
check_on_off(option.equalAxes);
case 'limitaxis'
option.axismax = optvalue;
case 'locationcolorbar'
option.locationColorBar=optvalue;
case 'markerdisplayed'
option.markerDisplayed=optvalue;
case 'markercolor'
option.markerColor=check_color(optvalue);
case 'markerkey'
option.markerKey=optvalue;
case 'markerlabel'
if iscell(optvalue)
option.markerLabel=optvalue;
else
try
keys(optvalue);
catch
error(['markerlabel value is not a cell array ' ...
'or map: ' optvalue]);
end
option.markerLabel=optvalue;
end
case 'markerlabelcolor'
option.markerLabelColor=check_color(optvalue);
case 'markerlegend'
option.markerLegend=optvalue;
check_on_off(option.markerLegend);
case 'markersize'
option.markerSize=optvalue;
case 'markersymbol'
option.markerSymbol=optvalue;
case 'nonrmsdz'
error('nonRMSDz is an obsolete option. Use CMapZdata instead.');
case 'normalized'
option.normalized=optvalue;
check_on_off(option.normalized);
case 'obsuncertainty'
option.obsUncertainty=optvalue;
case 'overlay'
option.overlay=optvalue;
check_on_off(option.overlay);
case 'ticks'
option.ticks=optvalue;
case 'titlecolorbar'
option.titleColorBar=optvalue;
case 'xticklabelpos'
option.xticklabelpos=optvalue;
case 'yticklabelpos'
option.yticklabelpos=optvalue;
otherwise
error(['Unrecognized option: ' optname]);
end
end % iopt loop
end %function get_target_diagram_options