在图形中添加两个边缘标签

时间:2020-01-31 09:19:27

标签: matlab plot graph label edges

我有下图,

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

我想添加第二个边缘标签,第一个标签在边缘上方,另一个标签在边缘下方。

1 个答案:

答案 0 :(得分:1)

我在其中一项工作中使用了它,我希望它也对您有用。

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