📄 plotbasistree.sci
字号:
function PlotBasisTree(basis,D,stree,titlestr)
// PlotBasisTree -- Display basis tree with decorated branch lengths
// Usage
// PlotBasisTree(btree,D,stree[,titlestr])
// Inputs
// btree basis tree (e.g. output of BestBasis)
// D max depth of tree
// stree stat tree of pkt table
// titlestr optional signal title
//
// Side Effects
// A plot of tree with height of each branch proportional
// to improvement in cost function obtained by splitting.
//
// Copyright Aldo I Maalouf
[lhs,rhs]=argn();
if rhs < 4,
titlestr = ' ';
end
stack = zeros(6,2^D+1);
k = 1;
stack(:,k) = [ 0 0 .5 0 .5 1. ]';
//
// get information about splitting costs and tree height
//
[maxheight,height] = CalcTreeHeight(stree,D);
if maxheight > 0
LockAxes([0 1 (-1.1)*maxheight 0]);
else
LockAxes([0 1 -1 1]);
end
titlestr = [ 'Basis Tree: ' titlestr];
xtitle(titlestr);
//
while(k > 0),
d = stack(1,k); b = stack(2,k); x = stack(3,k);
y = stack(4,k); w = stack(5,k); h = stack(6,k);
k=k-1;
if(basis(node(d,b)) == 0) , // terminal node
plot([(x-w/10) (x+w/10)],[y y ])
else
mtlb_plot([(x-w/2) (x+w/2)],[y y ]) //
h = max(height(node(d,b)), maxheight/D/10 ) ;
mtlb_plot([(x-w/2) (x-w/2)],[y (y-h) ])
k = k+1;
stack(:,k) = [(d+1) (2*b) (x-w/2) (y-h) (w/2) h]';
mtlb_plot([(x+w/2) (x+w/2)],[y (y-h) ])
k = k+1;
stack(:,k) = [(d+1) (2*b+1) (x+w/2) (y-h) (w/2) h]';
end
end
//UnlockAxes;
endfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -