@@ -9,13 +9,13 @@ function pcaProjection(Y,varargin)
99% the original and projected spaces.
1010% More precisely 6 distinct plots are created:
1111% 1. A 3D scatterplot with the line associated with the 1st PC.
12- % 2. A 3D scatterplot with main line and orthogonal projections.
13- % 3. A 3D scatterplot with orthogonal projections onto first 2 PCs plane
14- % of first 2 PC .
12+ % 2. A 3D scatterplot with the principal line and orthogonal projections.
13+ % 3. A 3D scatterplot with orthogonal projections onto the plane
14+ % of the first 2 PCs .
1515% 4. A 3D scatterplot projections onto the first three PCs.
16- % 5. A 3D scatterplot with the principal ellipsoid in the original coordinates space.
17- % 6. A 3D scatterplot with the principal ellipsoid in the projected coordinates space.
18-
16+ % 5. A 3D scatterplot with the principal ellipsoid in the projected coordinates space.
17+ % 6. A 3D scatterplot with the principal ellipsoid in the original coordinates space.
18+ %
1919%
2020% Required input arguments:
2121%
@@ -152,7 +152,7 @@ function pcaProjection(Y,varargin)
152152 % Call to pcaProjection with option addPCaxes and LineWidthAxes.
153153 close all
154154 load citiesItaly.mat
155- % Just show first principal axe
155+ % Just show first principal axis
156156 AddAxes=[true false false];
157157 % Line width of the axes
158158 l=4;
@@ -291,8 +291,10 @@ function pcaProjection(Y,varargin)
291291info = ver(' textanalytics' );
292292if isempty(info )
293293 fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
294+ TextAnToolbox= false ;
294295else
295296 textscatter3(Xtilde(: ,1 ),Xtilde(: ,2 ),Xtilde(: ,3 ),rownames ,' TextDensityPercentage' ,TextDensityPercentage )
297+ TextAnToolbox= true ;
296298end
297299
298300xlabel(varnames(1 ))
@@ -318,10 +320,7 @@ function pcaProjection(Y,varargin)
318320title(" 3D scatter plot with main line and orthogonal projections" )
319321
320322
321- info = ver(' textanalytics' );
322- if isempty(info )
323- fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
324- else
323+ if TextAnToolbox == true
325324 textscatter3(Xtilde(: ,1 ),Xtilde(: ,2 ),Xtilde(: ,3 ),rownames ,' TextDensityPercentage' ,TextDensityPercentage )
326325end
327326
@@ -355,10 +354,7 @@ function pcaProjection(Y,varargin)
355354
356355
357356
358- info = ver(' textanalytics' );
359- if isempty(info )
360- fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
361- else
357+ if TextAnToolbox == true
362358 textscatter3(Xtilde(: ,1 ),Xtilde(: ,2 ),Xtilde(: ,3 ),rownames , ...
363359 ' TextDensityPercentage' ,TextDensityPercentage );
364360end
@@ -380,13 +376,10 @@ function pcaProjection(Y,varargin)
380376
381377
382378
383- info = ver(' textanalytics' );
384- if isempty(info )
385- fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
386- else
379+ if TextAnToolbox == true
387380 textscatter3(Xtilde * v1 ,Xtilde * v2 ,Xtilde * v3 ,rownames ,' TextDensityPercentage' ,TextDensityPercentage );
388- xlabel(' PC1' ); ylabel(' PC2' ); zlabel(' PC3' );
389381end
382+ xlabel(' PC1' ); ylabel(' PC2' ); zlabel(' PC3' );
390383
391384
392385
@@ -413,10 +406,7 @@ function pcaProjection(Y,varargin)
413406
414407
415408
416- info = ver(' textanalytics' );
417- if isempty(info )
418- fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
419- else
409+ if TextAnToolbox == true
420410 textscatter3(Xtilde * v1 ,Xtilde * v2 ,Xtilde * v3 ,rownames ,' TextDensityPercentage' ,TextDensityPercentage );
421411end
422412
@@ -444,10 +434,7 @@ function pcaProjection(Y,varargin)
444434nfac= sqrt(size(XX1 ,1 ));
445435surf(reshape(XX1(: ,1 ),nfac ,nfac ),reshape(XX1(: ,2 ),nfac ,nfac ),reshape(XX1(: ,3 ),nfac ,nfac ),' FaceAlpha' ,0.1 ,' FaceColor' ,' none' );
446436
447- info = ver(' textanalytics' );
448- if isempty(info )
449- fprintf(' Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.' );
450- else
437+ if TextAnToolbox == true
451438 textscatter3(Xtilde(: ,1 ),Xtilde(: ,2 ),Xtilde(: ,3 ),rownames ,' TextDensityPercentage' ,TextDensityPercentage );
452439end
453440
0 commit comments