1- function geoplotFS(Y ,score ,ShapeFile )
1+ function geoplotFS(Y ,score ,ShapeFile , varargin )
22% geoplotFS calls geoplotAPP.mlapp to show an interactive geoplot with polygons
33%
44% <a href="matlab: docsearchFS('geoplotFS')">Link to the help function</a>
5- %
65%
7- % In the app it is also possible choose the variabile of Y to show, the
6+ %
7+ % In the app it is also possible choose the variable of Y to show, the
88% type of plot (i.e. in latitude and longitude coordinates or in the
99% original coordinates of ShapeFile), the direction of the colorbar.
1010% Note that this function requires that the "mapping toolbox" is installed.
@@ -21,7 +21,7 @@ function geoplotFS(Y,score,ShapeFile)
2121% computations.
2222% Data Types - single|double
2323%
24- % score : variable to show or nxp matrix containing variables
24+ % score : variable to show or nxp matrix containing variables
2525% to show.
2626% Numeric scalar, of string or character identifying the
2727% initial variable to use in the geoplot. Alternatively,
@@ -30,7 +30,7 @@ function geoplotFS(Y,score,ShapeFile)
3030% Example - 'ShapeFile','shapefileName'
3131% Data Types - char or string numeric scalar or nxp array.
3232%
33- % ShapeFile : name of ShapeFile or geotable containg shapes.
33+ % ShapeFile : name of ShapeFile or geotable containing shapes.
3434% Character or string or geotable.
3535% Name of the ShapeFile containing the containing the
3636% geometric details of the rows. The ShapeFile, which is
@@ -40,11 +40,16 @@ function geoplotFS(Y,score,ShapeFile)
4040% "Mapping toolbox" is installed.
4141% Example - 'ShapeFile','shapefileName'
4242% Data Types - char or string or geotable.
43- %
43+ %
4444% Optional input arguments:
4545%
46- % Output:
47- %
46+ % bsb : list of units forming the initial subset. Vector. If bsb is
47+ % not specified all unis are considered
48+ % Example - 'bsb',1:20
49+ % Data Types - single|double
50+ %
51+ % Output:
52+ %
4853%
4954%
5055% See also: biplotFS
@@ -105,7 +110,59 @@ function geoplotFS(Y,score,ShapeFile)
105110 geoplotFS(X,out.score,ShapeFile)
106111%}
107112
113+ %{
114+ %% Example of use of option bsb.
115+ load citiesItaly2024.mat
116+ X=citiesItaly2024;
117+ out=pcaFS(X,'biplot',0,'dispresults',0,'plots',0);
118+ ShapeFile=X.Properties.UserData{1};
119+ % Color based on PCs and use of option bsb
120+ % Select the provinces of Emilia-Romagna
121+ bsb=[33:40 99];
122+ geoplotFS(X,out.score,ShapeFile,'bsb',bsb)
123+ %}
124+
125+
108126%% Beginning of code
109- geoplotAPP(Y ,score ,ShapeFile )
127+ bsb= 1 : size(Y ,1 );
128+
129+ if nargin > 3
130+ options= struct(' bsb' ,bsb );
131+
132+
133+ [varargin{: }] = convertStringsToChars(varargin{: });
134+ UserOptions= varargin(1 : 2 : length(varargin ));
135+ if ~isempty(UserOptions )
136+
137+
138+ % Check if number of supplied options is valid
139+ if length(varargin ) ~= 2 * length(UserOptions )
140+ error(' FSDA:geoplotFS:WrongInputOpt' ,' Number of supplied options is invalid. Probably values for some parameters are missing.' );
141+ end
142+
143+ % Check if all the specified optional arguments were present
144+ % in structure options
145+ % Remark: the nocheck option has already been dealt by routine
146+ % chkinputR
147+ inpchk= isfield(options ,UserOptions );
148+ WrongOptions= UserOptions(inpchk == 0 );
149+ if ~isempty(WrongOptions )
150+ disp(strcat(' Non existent user option found->' , char(WrongOptions{: })))
151+ error(' FSDA:geoplotFS:NonExistInputOpt' ,' In total %d non-existent user options found.' , length(WrongOptions ));
152+ end
153+ end
154+
155+
156+ % Write in structure 'options' the options chosen by the user
157+ for i= 1 : 2 : length(varargin )
158+ options.(varargin{i })=varargin{i + 1 };
159+ end
160+
161+ bsb= options .bsb ;
162+
163+ end
164+
165+ geoplotAPP(Y ,score ,ShapeFile ,bsb )
166+
110167end
111168% FScategory:VIS-Mult
0 commit comments