addNodeClass (networkvisualizer)

index

addNodeClass (networkvisualizer)

Adds a new node class for a networkvisualizer object.

Syntax

net = addNodeClass(net, categories, classname)

Arguments

Description

Examples

Adding a node class

rng(1, 'twister'); % For reproducibility
W = [0 1 1 0 0;1 0 0 1 1;1 0 0 0 0;0 0 0 0 1;1 0 1 0 0];
categories = {'M', 'L', 'K', 'M', 'M'}';
net = networkvisualizer(W);
net.addNodeClass(categories);
plot(net);

which produces:

Updating the node sizes and labels based on the node class

% Set the node labels of category M to 'Category M'
net.setNodeLabels('Category M', 'M');
% Set the node sizes of M, K and L categories to 10, 6 and 20
net.setNodeSizes({10, 6, 20}, {'M', 'K', 'L'});
% Enabled automatic resizing to ensure labels are within the node borders
net.setNodeSizes('auto');
plot(net);

which produces:

Add an additional weight class and set line widths

% Add a new node class named Weight
weight_class = {'high', 'high', 'low', 'low', 'low'};
net.addNodeClass(weight_class, 'Weight');
% Set the node line width of 'high' category of 'Weight' class to 3
net.setNodeLineWidth(3, 'high', 'Weight');
plot(net);

which produces:

See Also

networkvisualizer, addEdgeClass, createEdgeClass, setNodeSizes, setNodeColors, setNodeLabels, setNodeLabelColor, setNodeLineWidth, setNodeLineStyle, setNodeFontSize, setNodeLineColor, setNodeCurvature