필터 지우기
필터 지우기

Plotting graph objects with curved edges and forced layout

조회 수: 8 (최근 30일)
Shaybe
Shaybe 2016년 8월 5일
답변: Sean de Wolski 2016년 8월 5일
I have a graph that I want to plot in a specific layout. My closest attempt is
plot(G,'layout',,'layered','Sources',[1 6] ,'Sinks',[5 10],'direction','right','linewidth',LWidths);
...
I can force X and Y coordinates of nodes in my graph to achieve the layout I want by using:
plot(G,'layout','force','Iterations',0,'XStart',X,'YStart',Y,'linewidth',LWidths);
...
However, this method causes some edges to overlap and become indistinguishable.
Is there any way to get curved edges at this point?

채택된 답변

Christine Tobler
Christine Tobler 2016년 8월 5일
편집: Christine Tobler 2016년 8월 5일
You could try this:
plot(G,'Layout','layered','Sources',1:5 ,'Sinks',6:10,'linewidth',LWidths);
This will place all nodes 1 to 5 on one layer, and nodes 6 to 10 on another, with the curved lines between nodes on the same layer.
  댓글 수: 2
Shaybe
Shaybe 2016년 8월 5일
Thanks for the idea! That almost gets me where I wanted.
Now node ids are scrambled in each layer...
Christine Tobler
Christine Tobler 2016년 8월 5일
That's too bad, I'm afraid there's no way of choosing the order of the nodes in a layer (they are permuted to try to minimize the number of edge crossings, which is not really necessary here, of course).
You could try the circle layout, perhaps coupled with giving the two groups of nodes different colors again. That would have nodes 1 to 5 on one side of the circle, and nodes 6 to 10 on the other side.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2016년 8월 5일

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by