フィルターのクリア

I want to draw a graph using circular layout with some nodes inside a circular layout.

10 ビュー (過去 30 日間)
s = [2 3 4 7 8];
t = [1 6 7 8 5];
G = graph(s,t);
plot(G,'Layout','circle','Center',7)
This code gives:
I want both nodes 7 and 8 inside.
How can this be done.

回答 (1 件)

Chunru
Chunru 2022 年 7 月 23 日
s = [2 3 4 7 8];
t = [1 6 7 8 5];
G = graph(s,t);
% Remove node 8 from gra[h
G1 = rmnode(G, 8);
figure;
h1 = plot(G1,'Layout','circle','Center',7);
figure;
h2 = plot(G);
h2.XData = [h1.XData(1:6) h1.XData(7)+[-.1 .1]]; % Node 7 & 8 around centre
h2.YData = [h1.YData(1:7) h1.YData(7)];
  3 件のコメント
Chunru
Chunru 2022 年 7 月 24 日
I think the layout function in MATLAB has no such option. You have to manually set the node position.
s = [2 3 4 7 8];
t = [1 6 7 8 5];
G = graph(s,t);
h1 = plot(G,'Layout','circle','Center',7);
h1.XData = [cosd(90-(0:5)*60) 0.1 -0.1];
h1.YData = [sind(90-(0:5)*60) 0 0];
axis equal
Shivanagouda Biradar
Shivanagouda Biradar 2022 年 7 月 25 日
Thank you very much !!!!!!!!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNetworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by