view m-toolbox/test/test_treeplot.m @ 30:317b5f447f3e
database-connection-manager
Update workspaceBrowser
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
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))