Modify Nodes and Edges of GraphPlot

조회 수: 10 (최근 30일)
Ephraim Bryski
Ephraim Bryski 2021년 1월 7일
답변: Christine Tobler 2021년 1월 8일
Hi. I would like to animate a graphplot. Nodes and edges should be added and removed over time, and the coordinates should be modified. Is there a way of modifying the graphplot without replotting (which I've noticed takes a lot of time)? Thanks.

채택된 답변

Christine Tobler
Christine Tobler 2021년 1월 8일
I'm afraid that's not possible with GraphPlot.
For performance, you could use scatter to plot all the nodes, and plot to plot all edges connecting these nodes as straight lines, this would be much more efficient - of course it loses some of the additional features, like placement of the nodes in an automatic graph plot.
Or maybe you could safe the plot of each timestep ahead of time and then play the animation based on this precomputed set?
In GraphPlot, in terms of node placement, if you don't already know the coordinates at which the nodes should be placed in each timestep, you could try feeding the coordinates of the last timestep to the 'XStart', 'YStart' options for the 'force' layout, which would make the nodes in the next step be in a more similar place to the previous one. Changing 'Iterations' to a smaller number could also be helpful there.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by