MATLAB Answers

Graph Plot Layout Variation

15 views (last 30 days)
Anushi1998
Anushi1998 on 5 Jun 2017
Answered: Steven Lord on 5 Jun 2017
Hi,
I have a graph with many nodes and I have plot them according to their frequency.
scatter(nodes,freq);
Here is obtained image of plot
Now I need to create a directed graph on that plot without changing the position of the node.
I can draw it by plotting lines according to the edges but there is a problem in plotting arrow in mid of line & also how to consider multiple edges and loops.
The problem can look as we have to change the layout of the graph such that all nodes are aligned according to X-axis label and the height of each node is to be varied according to the frequency of that node.
If there is some direct function available that will be more appreciated.

  0 Comments

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 5 Jun 2017
Generate a digraph object (you'll need to know which nodes should be connected by edges) and plot it. When you plot the digraph, you can specify the XData and YData properties to control exactly where the nodes are plotted. The example "Custom Graph Node Coordinates" in the documentation shows this technique.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!