From 6cd7f7b00a9c9960c79ef7214bbc1f6274e79aac Mon Sep 17 00:00:00 2001 From: MarcoRianiUNIPR Date: Thu, 2 Jan 2025 11:18:51 +0100 Subject: [PATCH] spmplot regenerated and redundant code inside typespm "number" rremoved --- toolbox/graphics/spmplot.m | 87 ++++++++++--------- toolbox/helpfiles/FSDA/images/spmplot_01.png | Bin 24862 -> 24862 bytes toolbox/helpfiles/FSDA/images/spmplot_02.png | Bin 27067 -> 27067 bytes toolbox/helpfiles/FSDA/images/spmplot_03.png | Bin 81343 -> 81343 bytes toolbox/helpfiles/FSDA/images/spmplot_04.png | Bin 58264 -> 58264 bytes toolbox/helpfiles/FSDA/images/spmplot_05.png | Bin 53229 -> 53229 bytes toolbox/helpfiles/FSDA/images/spmplot_06.png | Bin 37851 -> 37851 bytes toolbox/helpfiles/FSDA/images/spmplot_07.png | Bin 27667 -> 27667 bytes toolbox/helpfiles/FSDA/images/spmplot_08.png | Bin 27629 -> 27629 bytes toolbox/helpfiles/FSDA/images/spmplot_09.png | Bin 52978 -> 52978 bytes toolbox/helpfiles/FSDA/images/spmplot_10.png | Bin 36582 -> 36582 bytes toolbox/helpfiles/FSDA/images/spmplot_11.png | Bin 39822 -> 39822 bytes toolbox/helpfiles/FSDA/images/spmplot_12.png | Bin 41511 -> 41511 bytes toolbox/helpfiles/FSDA/images/spmplot_13.png | Bin 63456 -> 63456 bytes toolbox/helpfiles/FSDA/images/spmplot_14.png | Bin 47706 -> 47706 bytes toolbox/helpfiles/FSDA/images/spmplot_15.png | Bin 37401 -> 37401 bytes toolbox/helpfiles/FSDA/images/spmplot_16.png | Bin 46511 -> 46511 bytes toolbox/helpfiles/FSDA/images/spmplot_17.png | Bin 51693 -> 51693 bytes toolbox/helpfiles/FSDA/images/spmplot_18.png | Bin 41003 -> 41003 bytes toolbox/helpfiles/FSDA/spmplot.html | 15 ++-- 20 files changed, 54 insertions(+), 48 deletions(-) diff --git a/toolbox/graphics/spmplot.m b/toolbox/graphics/spmplot.m index 91ae2f3d9..5b9bac26a 100644 --- a/toolbox/graphics/spmplot.m +++ b/toolbox/graphics/spmplot.m @@ -280,7 +280,8 @@ % More precisely, typespm.lower controls how the part below % the diagonal is shown and typespm.upper controls the upper % part. Possible entries of typespm.lower or typespm.upper -% are "scatter", "circle", "square" "number" and "none"; +% are "scatter", "circle", "square" "number" (number without +% color), "cnumber" (colored number) and "none". % For example if typespm.lower="number" and % typespm.upper="circle", the correlations in the part below % the diagonal are shown with numbers and the upper part with @@ -1026,6 +1027,17 @@ spmplot(mtcars,'typespm',typespm,'order','FPC'); %} + %{ + %% Example of use of option order with cnumber. + % The order of the variables is based on the first + % eigenvector associated to the largest eigenvalue. + load mtcars + typespm=struct; + typespm.lower='circle'; + % Number whose size and color depends on the corresponding rxy + typespm.upper='cnumber'; + spmplot(mtcars,'typespm',typespm,'order','FPC'); +%} %% Beginning of code @@ -1939,12 +1951,12 @@ elseif method=="number" || method== "cnumber" % method contains "number" - if lunigroup==1 % just one group (number of cnumber) + if lunigroup==1 % just one group (number of cnumber) if method=="number" % Show number without color text(AX(i,j),0.5,0.5,num2str(R(i,j),2),'FontSize',Rresc(i,j), ... 'Units','normalized','HorizontalAlignment','center','Interpreter','Latex') - else + else % colored number % Show number with color which depends on % the value of R(i,j) ind=find(index<=R(i,j),1,'last'); @@ -1963,7 +1975,7 @@ end end - elseif method=="circle" || method =="square" || method =="number" %% TO DO remove here || method =="number" + elseif method=="circle" || method =="square" % create new axes in position i,j a=axes('Position',AX(i,j).Position); a.XTick=''; @@ -1976,54 +1988,45 @@ pos = [center-radius 2*radius 2*radius]; if lunigroup==1 - if method=="number" - text(0.5,0.5,num2str(R(i,j),2),'FontSize',Rresc(i,j), ... - 'Units','normalized','HorizontalAlignment','center') + ind=find(index<=R(i,j),1,'last'); + % rectangle('Position',pos, 'FaceColor', cmap(ind, :), 'EdgeColor', cmap(ind, :)) + if method=="circle" + rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) else - ind=find(index<=R(i,j),1,'last'); - % rectangle('Position',pos, 'FaceColor', cmap(ind, :), 'EdgeColor', cmap(ind, :)) - if method=="circle" - rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) - else - rectangle('Position',pos, 'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) - end + rectangle('Position',pos, 'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) end else - if method=="number" - text(0.2,0.5,num2str(R(i,j),2),'FontSize',Rresc(i,j), ... - 'Units','normalized','HorizontalAlignment','center') + radius = max(abs(R(i,j)), 0.0001) * 3; + radius=radius/lunigroup; + center=[-2 0]; + pos = [center-radius 2*radius 2*radius]; + ind=find(index<=R(i,j),1,'last'); + if method=="circle" + rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) else - radius = max(abs(R(i,j)), 0.0001) * 3; - radius=radius/lunigroup; - center=[-2 0]; - pos = [center-radius 2*radius 2*radius]; - ind=find(index<=R(i,j),1,'last'); - if method=="circle" - rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) - else - rectangle('Position',pos, 'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) - end + rectangle('Position',pos, 'FaceColor', [cmap(ind, :) , abs(R(i,j))], 'EdgeColor', cmap(ind, :)) + end - step=3/lunigroup; - center=[2 -3-step]; - for jjj=1:lunigroup - if method=="number" - text(0.6,jjj/(lunigroup+1),num2str(Rgroup(i,j,jjj),2), ... - 'Units','normalized','FontSize',Rgroupresc(i,j,jjj),'Color',clr(jjj)) + step=3/lunigroup; + center=[2 -3-step]; + for jjj=1:lunigroup + if method=="number" + text(0.6,jjj/(lunigroup+1),num2str(Rgroup(i,j,jjj),2), ... + 'Units','normalized','FontSize',Rgroupresc(i,j,jjj),'Color',clr(jjj)) + else + radius= max(abs(Rgroup(i,j,jjj)), 0.0001)* 3/lunigroup; + center(2)=center(2)+2*step; + pos = [center-radius 2*radius 2*radius]; + ind=find(index<=Rgroup(i,j,jjj),1,'last'); + if method=="circle" + rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(Rgroup(i,j,jjj))] , 'EdgeColor', cmap(ind, :)) else - radius= max(abs(Rgroup(i,j,jjj)), 0.0001)* 3/lunigroup; - center(2)=center(2)+2*step; - pos = [center-radius 2*radius 2*radius]; - ind=find(index<=Rgroup(i,j,jjj),1,'last'); - if method=="circle" - rectangle('Position',pos, 'Curvature',[1 1],'FaceColor', [cmap(ind, :) , abs(Rgroup(i,j,jjj))] , 'EdgeColor', cmap(ind, :)) - else - rectangle('Position',pos,'FaceColor', [cmap(ind, :) , abs(Rgroup(i,j,jjj))] , 'EdgeColor', cmap(ind, :)) - end + rectangle('Position',pos,'FaceColor', [cmap(ind, :) , abs(Rgroup(i,j,jjj))] , 'EdgeColor', cmap(ind, :)) end end end + end % axis equal is very slow: replaced diff --git a/toolbox/helpfiles/FSDA/images/spmplot_01.png b/toolbox/helpfiles/FSDA/images/spmplot_01.png index c310483751fb0a86f9005e4781b7dc22382243bc..3682bf900d084c9f78b62b03f0b109b3d6e028e3 100644 GIT binary patch delta 21 dcmbPth;iN_#tAwcOk4sAVrRF_+i3DC0RUAK2q^#n delta 21 dcmbPth;iN_#tAwcjKT(T&RIL!Hk!Oj0030q2m=5B diff --git a/toolbox/helpfiles/FSDA/images/spmplot_02.png b/toolbox/helpfiles/FSDA/images/spmplot_02.png index 124f28529ecc527e1ef0b40d166d70e5281da538..747ba073040c7532af91c828b07a38d354346631 100644 GIT binary patch delta 21 dcmdmenQ`}J#tAwcOk4s=KMr5tw9%wJ698j82|54( delta 21 dcmdmenQ`}J#tAwcjKT&AP25X$H=49(0svS<2YUbj diff --git a/toolbox/helpfiles/FSDA/images/spmplot_03.png b/toolbox/helpfiles/FSDA/images/spmplot_03.png index 1fa5f866c5fa2883199b8f49f1ce09e754f12321..3d41cedce105635ac04a0b7efb77ea7ff5da8e1f 100644 GIT binary patch delta 24 gcmdo0n`QrRmI*o>Ok4tbA4_M?Y&6+w!q{yK0D(LSi~s-t delta 24 gcmdo0n`QrRmI*o>jKT(bshc~r8cnvEFm~Gl0DF)K4<_S6+Ok4u`ZAGj3H=67`4**)-2u%P0 delta 21 dcmaDmpZV>4<_S6+jKT&6^Y?7^+-S1%JOE&+2^|0c diff --git a/toolbox/helpfiles/FSDA/images/spmplot_06.png b/toolbox/helpfiles/FSDA/images/spmplot_06.png index f689003d5092660cb78a6dda2ef07bd21763547d..efbade6cf7147e4673e3712e52bde32f18b872e2 100644 GIT binary patch delta 21 dcmcb;oay#*rU^P6Ok4s6+*QkdZ8TXv830+P2weaG delta 21 dcmcb;oay#*rU^P6jKT&6^Y?7^+-S0VG5}tX2)O_N diff --git a/toolbox/helpfiles/FSDA/images/spmplot_07.png b/toolbox/helpfiles/FSDA/images/spmplot_07.png index b0775e2ac88b0f4bd29cd2bb0880c0af114316c2..9ab5521039e21c8655a0bd50b792a70310c34b3c 100644 GIT binary patch delta 21 dcmbPygK_c=#tAwcOk4sMtPAx{Y&5x_4FFR|2fP3P delta 21 dcmbPygK_c=#tAwcjKT&M6Vq+0H=5kf1^`xp2lxO0 diff --git a/toolbox/helpfiles/FSDA/images/spmplot_08.png b/toolbox/helpfiles/FSDA/images/spmplot_08.png index 2e304fa5939f407323f65108f7b2135c72d5a367..65138b43bebeb817023f6b0760df389f29852c3f 100644 GIT binary patch delta 21 dcmaERo$>8;#tAwcOk4sMtPAx{Y&6-K4FF(_2uJ_` delta 21 dcmaERo$>8;#tAwcjKT&M6Vq+0H=69s1^{Em2!sFt diff --git a/toolbox/helpfiles/FSDA/images/spmplot_09.png b/toolbox/helpfiles/FSDA/images/spmplot_09.png index b4a52c9af8934cef7b309e1ec141ec3c6ef3acdc..86d04fbe932bca2d64605561ba3fb5fbb8ceddb1 100644 GIT binary patch delta 21 dcmew~m-*9N<_S6+Ok9EtCOejkZ#3C=4ggs!2q6Ff delta 21 dcmew~m-*9N<_S6+jKYSD*DG6$Hk#}^2LN5*2&Mo4 diff --git a/toolbox/helpfiles/FSDA/images/spmplot_10.png b/toolbox/helpfiles/FSDA/images/spmplot_10.png index 6af6b32372c554ba6ba6a39bd6ab4afedbdf980c..196a0acbf52765782307223668e64e8094b3a9d9 100644 GIT binary patch delta 21 dcmaDhm+9GDrU^P6Ok9GD&ikh~ZZz4{2LM??2rK{q delta 21 dcmaDhm+9GDrU^P6jKYS@mgP_7Hkxee0{~cu2k!s? diff --git a/toolbox/helpfiles/FSDA/images/spmplot_11.png b/toolbox/helpfiles/FSDA/images/spmplot_11.png index 3a2011114e40b4c69d06d07b0bf178a69085512e..6a106a440579903263ad7a4f42d130b3505856fb 100644 GIT binary patch delta 21 dcmeC%&eXS^X@U+16PF}IR8%@@H2LN5@2nPTF delta 21 dcmaFxp83Ih<_S6+jKYR|?#E^>-e|JsI{;_I35@^% diff --git a/toolbox/helpfiles/FSDA/images/spmplot_14.png b/toolbox/helpfiles/FSDA/images/spmplot_14.png index 42c7bd783cf53a38ad8e144c258e05ed68173ca0..9812031486fcebb60e8b81dd536c523a73d14fcf 100644 GIT binary patch delta 21 dcmcchh3VE8rU^P6Ok9H8i?izHZ!}Tc1ps6l2z&ql delta 21 dcmcchh3VE8rU^P6jKYS(DhIw+Z8TBa1psDk2-N@p diff --git a/toolbox/helpfiles/FSDA/images/spmplot_15.png b/toolbox/helpfiles/FSDA/images/spmplot_15.png index b0211efeace8eecdbe9e380c0e69542476cba66d..9c4876002cb329c2c4f63fbc2651036fa05f9264 100644 GIT binary patch delta 21 dcmbQaglXmyrU^P6Ok9HeOW1d{Z8Uj05dcnG2ekkI delta 21 dcmbQaglXmyrU^P6jKYRuA*&d_ZZvs15dcs72kig= diff --git a/toolbox/helpfiles/FSDA/images/spmplot_16.png b/toolbox/helpfiles/FSDA/images/spmplot_16.png index 08bbe9d5a6929b58f4bd9423e699eb117520d08d..4efe6e4b0f27388c70110665a138da213a8cb17c 100644 GIT binary patch delta 21 dcmZ4gnrZ!OrU^P6Ok9G3aUAVWH=0y$1pryv2oeAQ delta 21 dcmZ4gnrZ!OrU^P6jKYQzn}u{fZ8WLg3IJTa2vPt5 diff --git a/toolbox/helpfiles/FSDA/images/spmplot_17.png b/toolbox/helpfiles/FSDA/images/spmplot_17.png index de932bb26c7f70697342092fb22f6dc6bb2e9743..e9bf882d96a2e0436f3360f22be31a2e8e4fd7af 100644 GIT binary patch delta 21 dcmaDmnfdKx<_S6+Ok9Gp;rmXX+i0@$BmiBS2^s(Z delta 21 dcmaDmnfdKx<_S6+jKYT6JcoRrY&6+<5&&B52%!J~ diff --git a/toolbox/helpfiles/FSDA/images/spmplot_18.png b/toolbox/helpfiles/FSDA/images/spmplot_18.png index 0d96f91b38777b48cb410f7249e5873ff2ddc486..b36ea4096fee8eab5bd267800691afed17c1897a 100644 GIT binary patch delta 21 dcmZ2|fNAvsrU^P6Ok9GRWnA{v8%@5?2LMsc2bur? delta 21 dcmZ2|fNAvsrU^P6jKW5&zb%DdY&7{k9{^ai2$TQ- diff --git a/toolbox/helpfiles/FSDA/spmplot.html b/toolbox/helpfiles/FSDA/spmplot.html index 522a43cd6..8880f01d6 100644 --- a/toolbox/helpfiles/FSDA/spmplot.html +++ b/toolbox/helpfiles/FSDA/spmplot.html @@ -493,12 +493,14 @@

Example: 'group',group

Data Types: char

order —Order of the variables in the scatterplot matrix.character | string.

Order in which the variables are shown inside - spmplot. Possible values are: + spmplot. Variable reordering can be used to improve the + visualization by placing similar variables next to each other.

+ Possible values are: "alphabet"=alphabetical order is used;

"original"= the order in the input argument Y is preserved (this is the default option);

- "AOE" = the angular order of the first two eigenvectors is used.

- More precisely, the order of the variables is calculated from + "AOE" = the angular order of the first two eigenvectors is used.

+ More precisely, the order of the variables is calculated from the order of the angles, $a_i$:

\[ a_i= tan^{-1}(e_{i1}/e_{i1}) \qquad \mbox{if} \qquad e_{i1}>0; @@ -645,7 +647,8 @@ More precisely, typespm.lower controls how the part below the diagonal is shown and typespm.upper controls the upper part. Possible entries of typespm.lower or typespm.upper - are "scatter", "circle", "square" "number" and "none";

+ are "scatter", "circle", "square" "number" (number without + color), "cnumber" (colored number) and "none".

For example if

Value Description
lower

"number" and

upper

"circle", the correlations in the part below the diagonal are shown with numbers and the upper part with circles. Similarly, if typespm.lower="none" and

scatter

"none" just the upper part of the scatter @@ -653,7 +656,7 @@ be characters or strings.

typespm='lower' is equivalent to typespm=struct;

typespm.lower='scatter', typespm.upper='number';

Example: 'typespm','lower' -

Data Types: char or struct

undock —Panel to undock and visualize separately.matrix | logical matrix.

If undock='' (default), no panel is extracted. If +

Data Types: scalar char or string or alternatively a struct

undock —Panel to undock and visualize separately.matrix | logical matrix.

If undock='' (default), no panel is extracted. If undock is a r-by-2 matrix, it specifies the r coordinates of the scatter plot matrix to undock and visualize separately in a bivariate plot (i.e. for panels out of the @@ -758,5 +761,5 @@

References

Friendly M. (2002), Corrgrams: Exploratory Displays for Correlation - Matrices. The American Statistician, v. 56, pp. 316–324, + Matrices. The American Statistician, v. 56, pp. 316–324, https://doi.org/10.1198/000313002533

This page has been automatically generated by our routine publishFS
\ No newline at end of file