Skip to content

Commit 1f9de2f

Browse files
fixed presence of Text Analytic toolbox
1 parent 5e29543 commit 1f9de2f

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

toolbox/graphics/pcaProjection.m

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
291291
info = ver('textanalytics');
292292
if isempty(info)
293293
fprintf('Text Analytics Toolbox is NOT installed.\n Units labels will not be shown.');
294+
TextAnToolbox=false;
294295
else
295296
textscatter3(Xtilde(:,1),Xtilde(:,2),Xtilde(:,3),rownames,'TextDensityPercentage',TextDensityPercentage)
297+
TextAnToolbox=true;
296298
end
297299

298300
xlabel(varnames(1))
@@ -318,10 +320,7 @@ function pcaProjection(Y,varargin)
318320
title("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)
326325
end
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);
364360
end
@@ -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');
389381
end
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);
421411
end
422412

@@ -444,10 +434,7 @@ function pcaProjection(Y,varargin)
444434
nfac=sqrt(size(XX1,1));
445435
surf(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);
452439
end
453440

0 commit comments

Comments
 (0)