我正在尝试在 Matlab 中绘制传记。我想显示节点的名称和每条边的标签。我正在设置特定边缘的标签。并设置传记的选项以显示边缘的标签,但它仍然没有显示它们。我错过了什么?有没有办法通过列表设置边缘的名称?还是你必须一一做?
谢谢你。
这是代码:
cm = sparse([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]);
names = {'E1','E2','E3','E4','E5'};
bg = biograph(cm,names,'LayoutType','radial','ShowTextInNodes','Label');
bg.nodes(1).Shape = 'circle';
bg.nodes(1).Size = [2 2];
bg.nodes(1).color = [.5 .7 1];
bg.edges(1).LineColor =[.5 .7 1];
bg.edges(1).Label = 'labelzz';
bg.edges(1).Description = 'Descriptionzz';
get(bg);
get(bg.edges(1));
gObj = view(bg);
这是结果:
Biograph object with 5 nodes and 9 edges.
ID: ''
Label: ''
Description: ''
LayoutType: 'radial'
LayoutScale: 1
Scale: 1
NodeAutoSize: 'on'
ShowTextInNodes: 'label'
EdgeType: 'curved'
EdgeTextColor: [0 0 0]
ShowArrows: 'on'
ArrowSize: 8
ShowWeights: 'off'
EdgeFontSize: 8
NodeCallbacks: @(node)inspect(node)
EdgeCallbacks: @(edge)inspect(edge)
CustomNodeDrawFcn: []
Nodes: [5x1 biograph.node]
Edges: [9x1 biograph.edge]
ID: 'E1 -> E2'
Label: 'labelzz'
Description: 'Descriptionzz'
Weight: 1
LineWidth: 0.5000
LineColor: [0.5000 0.7000 1]
UserData: []
图表图像: