Mercurial > hg > ltpda
view 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 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))