Is there any way to increase the radius of a circular formatted directed graph?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Chris Endemann
am 20 Dez. 2018
Kommentiert: Steven Lord
am 21 Dez. 2018
I am plotting a directed graph with nodes of the graph arranged in a circle using:
G=digraph(weights);
p=plot(G);
layout(p,'circle')
This suits my needs pretty well, but I would really like the radius of the circle to be larger. It does not look like radius size is an optional argument for the layout(p,'circle') command, but this would be really convenient if it were! How might I proceed? Is there any way to increase the radius of my circular formatted directed graph?
0 Kommentare
Akzeptierte Antwort
Aoi Midori
am 21 Dez. 2018
I did not entirely see what you precisely meant by "increase the radius" but here I offer you an example of changing the properties. For instance, using the command below, you can double the positions of the nodes horizontally.
p.XData = 2*p.XData;
Likewise, you can double them vertically.
p.YData = 2*p.YData;
0 Kommentare
Weitere Antworten (1)
Cris LaPierre
am 21 Dez. 2018
From the documentation page for layout, "Circular layout. Places the graph nodes on a circle centered at the origin with radius 1. "
I also don't see a way to change that.
1 Kommentar
Steven Lord
am 21 Dez. 2018
Once you've laid out the graph or digraph in a circle retrieve the properties of the plot object, scale them appropriately, and set those same properties to the scaled values.
Make a sample digraph:
A = [0 10 20 30; 10 0 2 0; 20 2 0 1; 30 0 1 0];
G = digraph(A);
Plot it.
h = plot(G, 'Layout', 'circle');
Scale the X and Y coordinates of the vertices by 2.
h.XData = 2*h.XData;
h.YData = 2*h.YData;
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!