Code covered by the BSD License  

Highlights from
functor

image thumbnail

functor

by

 

Automated composition of function handles

bioPlot(labels,nodeType,adj)
function bioPlot(labels,nodeType,adj)
% Plot graph with two different types of nodes using bio toolbox 
%
% labels    nNodes x 1 cell array
% nodeType  nNodes x 1 integer   1-rectangle 2-ellipse
% adj       nNodes x nNodes adjacency array

bg = aBioGraph(labels,nodeType,adj);
bg.dolayout;
bg.view

end

function bg = aBioGraph(labels,nodeType,adj)
% Small modification of default biograph

bg = biograph(adj, labels,'ShowArrows','on','ShowWeights','off');

for m=1:length(labels)
    gns = bg.Nodes(m).Size;
    gfs = bg.Nodes(m).FontSize;
    switch nodeType(m),
        case 2
            set(bg.Nodes(m),'shape','rectangle','color',[0 1 0],'Size',2*gns','FontSize',2*gfs);
        case 1
            set(bg.Nodes(m),'shape','ellipse','Size',2*gns,'FontSize',2*gfs);
    end
end

end

Contact us