This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp2/Project_2_Maggioni_Claudio/householder/drawit.m

29 lines
728 B
Mathematica
Raw Permalink Normal View History

2020-09-29 11:58:49 +00:00
% DRAWIT Script to plot the graph of coauthors from Householder 93.
if ~exist('prcm')
load housegraph;
end;
% A is the adjacency matrix.
% prcm is a permutation; any permutation could be substituted.
% name is the vector of people's names.
% xy is just xy coords of points on the unit circle (and the origin).
Aperm = A(prcm,prcm);
nameperm = name(prcm,:);
nfolks = max(size(A));
clf
gplot(Aperm,xy);
axis off;
x = xy(:,1) * 1.05;
y = xy(:,2) * 1.05;
x(1) = .08; % Put names(1) in the center of the circle.
y(1) = .06;
h = text(x,y,nameperm);
for k = 2:nfolks % Shrink the font for the other names, and rotate them.
set(h(k),'fontsize',10);
set(h(k),'rotation',180/pi*atan2(y(k),x(k)));
end;