How can I create a Graph with specific coordinates?
54 views (last 30 days)
Show older comments
Hello,
I have two vectors (6,1), one for X coordinates and the other for the Y coordinates. I want to use the function Graph to create a graph that join each (x(i),y(i)) in a specific way, in this case:
s=[1,2,5,5,5,5,6,6,6,6]
t=[3,4,1,2,3,4,1,2,3,4]
graph(s,t)
I don't know how to locate the vertices in my specifc coordinates, If anyone know how to do it I would be grateful.
Thank you so much.
0 Comments
Answers (1)
Steven Lord
on 27 Jul 2020
When you call plot on your graph you can specify the X, Y, and Z coordinates of the nodes. See the "Custom Graph Node Coordinates" example on the documentation page for the plot for graph objects.
If you want to keep the graph and the coordinate data together, add the coordinates as additional attributes on the graph object.
See Also
Categories
Find more on Graph and Network Algorithms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!