Coordinates of nodes in plot graph
7 ビュー (過去 30 日間)
古いコメントを表示
Hi,
after displaying a graph with the "Force Directed" algorithm by calling
plot(graph(G), 'force')
I would like to get the coordinates of the nodes of the displayed graph. Is there a way to extract them or to only call the "Force Directed" algorithm to get those?
Best Regards
0 件のコメント
採用された回答
Steven Lord
2021 年 2 月 1 日
B = graph(bucky);
h = plot(B);
X = h.XData;
Y = h.YData;
fprintf("Node 1 is located at (%f, %f)\n", X(1), Y(1))
% Turn on the axes ticks so you can check the coordinates
ax = ancestor(h, 'axes');
ax.XTickMode = 'auto';
ax.YTickMode = 'auto';
xticks(-5:5)
% Draw lines -- X marks the spot
xline(X(1), 'r')
yline(Y(1), 'r')
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
