view m-toolbox/test/test_treeplot.m @ 50:7d2e2e065cf1 database-connection-manager

Update unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents f0afece42f48
children
line wrap: on
line source

clear;

p = [0 1 2 2 1 3 3 4 5 6 7]

p = [0 1 2 3 4 3 6 2 8 1 10]

[x,y,h]=treelayout(p);
f = find(p~=0);
pp = p(f);
X = [x(f); x(pp); repmat(NaN,size(f))];
Y = [y(f); y(pp); repmat(NaN,size(f))];
X = X(:);
Y = Y(:);

% figure
hfig = [figure];

% axes objects
a = plot (X, Y, 'r--', x, y, 'bo');
set(a(2), 'MarkerFaceColor', 'b');
set(a(2), 'MarkerSize', 12);

% text objects
strs = [];
a    = [];
for j=1:length(x)
  a = [a text(x(j)+0.03, y(j), num2str(p(j)))];
end
set(a, 'EdgeColor', 'k', 'Fontsize', 10);
set(a, 'BackgroundColor', 'w');

axis([0 1 0 1]);
box off;
axis off;

title(num2str(p))