Natasha
Natasha

Reputation: 1521

Adding two edge labels in graph

I've the following graph,

s = [1 1 1 2 2];
t = [2 3 4 2 5];
G = graph(s,t);
h = plot(G);
weights = [5 10 15 10 10];
% I could add one edge label using labeledge command
labeledge(h,1:numedges(G),weights);

% label2
% labeledge(h,1:numedges(G),['t1','t2','t3','t4','t5']); % I want to add this

I'd like to add a second edge label, the first label above the edge and the other label below the edge.

Upvotes: 0

Views: 69

Answers (1)

Bozmaje
Bozmaje

Reputation: 75

I was used this in one of my work, I hope it's work for you too.

 edgelabelstr = string(g.Edges.precipitation) + " | " + string(g.Edges.runoff); 
%I showed precipitation and runoff label together

Upvotes: 1

Related Questions