[英]Legend in biograph plot in Matlab
I have a biograph
object, and I want to "color-code" the edges and vertices. 我有一个
biograph
对象,并且想对边缘和顶点进行“颜色编码”。
Is it possible to get legends in the biograph plot, similar to the ones in plot
. 是否有可能获得传说中的Biograph情节,类似的那些
plot
。
My code is like this: 我的代码是这样的:
Sys = sparse(from_nodes, to_nodes,1,s,s);
SysTri = tril(Sys + Sys');
h = view(biograph(SysTri,[],'ShowArrows','off','ShowWeights','off'));
%% One of the parts I'm coloring:
set(h.Nodes(node_list1),'Color',[1 0.4 0.4])
fowEdges = getedgesbynodeid(h,get(h.Nodes(node_list1),'ID'));
revEdges = getedgesbynodeid(h,get(h.Nodes(fliplr(node_list1)),'ID'));
edges = [fowEdges;revEdges];
set(edges,'LineColor',[1 0 0])
set(edges,'LineWidth',1.5)
Now, I would like to do something like this: 现在,我想做这样的事情:
legend(h,'Node list 1', 'Node list 2');
Does anyone know if something like this is possible? 有人知道这样的事情是否可能吗?
If this is something you only want to do a few times, you could probably do it manually. 如果您只想几次这样做,则可以手动进行。
You can try to print to figure from the biograph window, and add labels there. 您可以尝试从传记窗口打印图形,然后在其中添加标签。
尝试:
legend(h.Nodes(node_list1), {'Node list 1'}, 'Location','SouthWest', 'Color','g');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.