Mercurial > hg > ltpda
comparison m-toolbox/test/test_treeplot.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 clear; | |
2 | |
3 p = [0 1 2 2 1 3 3 4 5 6 7] | |
4 | |
5 p = [0 1 2 3 4 3 6 2 8 1 10] | |
6 | |
7 [x,y,h]=treelayout(p); | |
8 f = find(p~=0); | |
9 pp = p(f); | |
10 X = [x(f); x(pp); repmat(NaN,size(f))]; | |
11 Y = [y(f); y(pp); repmat(NaN,size(f))]; | |
12 X = X(:); | |
13 Y = Y(:); | |
14 | |
15 % figure | |
16 hfig = [figure]; | |
17 | |
18 % axes objects | |
19 a = plot (X, Y, 'r--', x, y, 'bo'); | |
20 set(a(2), 'MarkerFaceColor', 'b'); | |
21 set(a(2), 'MarkerSize', 12); | |
22 | |
23 % text objects | |
24 strs = []; | |
25 a = []; | |
26 for j=1:length(x) | |
27 a = [a text(x(j)+0.03, y(j), num2str(p(j)))]; | |
28 end | |
29 set(a, 'EdgeColor', 'k', 'Fontsize', 10); | |
30 set(a, 'BackgroundColor', 'w'); | |
31 | |
32 axis([0 1 0 1]); | |
33 box off; | |
34 axis off; | |
35 | |
36 title(num2str(p)) | |
37 |