Change Node & Edges position on Plot

12 views (last 30 days)
Mohamed on 26 Jun 2022
Commented: Christine Tobler on 2 Aug 2022 at 14:43
I'm trying to draw a network using Graph function, where nodes represent RMU and Edges represent Cable , but i wanna change the postion of multibale Nodes on the plot figure so that is can see the network and compare it to the original SLDs

Accepted Answer

Steven Lord
Steven Lord on 26 Jun 2022
See the "Adjust Properties of GraphPlot Object" example on this documentation page for a demonstration of how to set custom node locations. Alternately you may want to use the layout function linked in the Object Functions section on that page to use different algorithms to compute the coordinates for the points.
Christine Tobler
Christine Tobler on 2 Aug 2022 at 14:43
You should be able to assing to the XData and YData properties of the H object in your code:
g = graph(2, 3);
H = plot(g, 'Layout', 'force');
H.XData = [1 3 2];
In the helper functions you're using, you would need to retrieve the GraphPlot object represented by H and modify its properties XData and YData.
Also, here's a blog post on how to make nodes in a GraphPlot object move by clicking on them:

Sign in to comment.

More Answers (0)




Community Treasure Hunt

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

Start Hunting!