setNodeLabels (networkvisualizer)

index

setNodeLabels (networkvisualizer)

Set the node labels of a networkvisualizer object.

Syntax

net = setNodeLabels(net, values)
net = setNodeLabels(net, values, categories)
net = setNodeLabels(net, values, categories, classname)

Arguments

Description

Examples

Setting the node labels

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];
labels = {'M30931','L07625','K03454','M27323','M15390'};
net = networkvisualizer(W);
net = setNodeLabels(net, labels);
plot(net);

which produces:

Updating labels using node classes

categories = {'M', 'L', 'K', 'M', 'M'}';
net = addNodeClass(net, categories);
net = setNodeLabels(net, {'Category M'}, 'M');
net = setNodeFontSize(net, 9.5, 'M');

which produces:

See Also

networkvisualizer, addNodeClass, setNodeSizes, setNodeFontSize