diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/test/test_treeplot.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,37 @@
+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))
+