addEdgeClass (networkvisualizer)

index

addEdgeClass (networkvisualizer)

Adds a new edge class for a networkvisualizer object.

Syntax

net = addEdgeClass(net, categories, classname)

Arguments

Description

Examples

Adding an edge 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];
labels ={'A', 'B', 'C', 'D', 'E'}';
net = networkvisualizer(W);
% Add a randomized edge category having 1, 2 and 3 as values
edge_categories = randi([1 3], length(net.Edges), 1);
net.addEdgeClass(edge_categories, 'EdgeCategory');
% Set the edge colors and line widths based on the edge category
net.setEdgeColors([0 0 1; 0 0 0], [2; 3], 'EdgeCategory');
net.setEdgeLineWidth({1.5, 5, 3.5}, {1, 2, 3}, 'EdgeCategory');
plot(net);

which produces:

See Also

networkvisualizer, addNodeClass, createEdgeClass, setEdgeLineWidth, setEdgeColors, setEdgeLineStyle