Akzeptierte Antwort

Steven Lord
Steven Lord am 21 Mai 2020

0 Stimmen

On the documentation page for the plot method of graph objects see the "Custom Graph Node Coordinates" example for how to plot nodes of your graph in specific locations.
The documentation page describing various types of customization you can do to a plotted graph may also be of use to you.

Weitere Antworten (1)

Ameer Hamza
Ameer Hamza am 20 Mai 2020

1 Stimme

Try this code
s = randi([1 100], 1, 2000);
t = randi([1 100], 1, 2000);
G = graph(s, t);
p = plot(G, 'Layout', 'subspace');
p.NodeLabel = [];
p.MarkerSize = 10;
p.NodeCData = 1:100;
p.EdgeColor = [0.5 0.5 0.5];
colormap(autumn)
colorbar

5 Kommentare

z cy
z cy am 21 Mai 2020
Thanks for your answer! I am so sorry not to express clearly. I need to plot two figures so that the situation becomes complicated.
The first figure is that each points need to fully connect with others. If the number of points is n, the connections of each points will be n-1.
The second figure is shown above all points only connect with extal serval anchor points. If the number of anchor points is m, the connections of points will be m.
I want to try use coordinate and adjacency matrix rather than not the connection relations to ensure the points are not changed.
Could you give me some suggestions? I am looking forward to your answer !
Ameer Hamza
Ameer Hamza am 21 Mai 2020
Do you have the adjacency matrix for your graphs?
z cy
z cy am 21 Mai 2020
I can calculate the anchor points.So, simply, if connected, set 1.
Ameer Hamza
Ameer Hamza am 21 Mai 2020
Bearbeitet: Ameer Hamza am 21 Mai 2020
Do you have the code to create the adjacency matrix? Also, do you want to use custom coordinates for the node position?
z cy
z cy am 23 Mai 2020
yes. Thank you!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 20 Mai 2020

Kommentiert:

am 23 Mai 2020

Community Treasure Hunt

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

Start Hunting!

Translated by