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
| function radar(P,color,str)
% RADAR Radar plot
% RADAR
%
% See also POLAR, ROSE, COMPASS
%
%
if nargin==0
P = [30 18 23 52 69 ; 20 45 38 85 34].';
color = [1 0 0 ; 0 0 1];
str = {'Perf' 'Rapidité' 'Communauté' 'Simplicité' 'Portabilité'};
end
[nPVal,nP] = size(P);
th = linspace(0,2*pi,nPVal+1).';
r = linspace(0,100,6);
x = sin(th);
y = cos(th);
figure
% Fond blanc du graphique
fill(x*r(end),y*r(end),'w');
hold on
% Lignes concentriques
line(x*r(2:end),y*r(2:end),'color','k','linestyle',':');
% Tracé des données
for n=1:nP
patch('xdata',x(1:end-1).*P(:,n), 'ydata',y(1:end-1).*P(:,n), ...
'facecolor','none', edgecolor',color(n,:));
text(1.05*x(1:end-1).*P(:,n),1.05*y(1:end-1).*P(:,n),strcat(num2str(P(:,n),'%d'),' %'),'color',color(n,:));
end
% Labels en bout d'axe
text(1.1*x(1:end-1)*r(end),1.1*y(1:end-1)*r(end),str,'hor','center','vert','middle');
% Lignes issues du centre du graphique
line([zeros(1,numel(x)-1);r(end)*x(1:end-1).'],[zeros(1,numel(y)-1);r(end)*y(1:end-1).'], ...
'color','k');
% Mise en forme de l'objet Axes
axis equal off |