フィルターのクリア

Plot multiple edge sets on one graph?

3 ビュー (過去 30 日間)
Keaton Ellis
Keaton Ellis 2022 年 8 月 27 日
コメント済み: Keaton Ellis 2022 年 8 月 29 日
I have multiple adjacency matrices of digraphs that correspond to different relations over the same set of nodes. Is there a clean way for me to plot the different graphs using the same set of nodes?

採用された回答

Chunru
Chunru 2022 年 8 月 28 日
% Create a graph
A = magic(4);
A(A>10) = 0;
names = {'alpha' 'beta' 'gamma' 'delta'};
G = digraph(A,names,'omitselfloops');
h1=plot(G);
% Now different edges
A(1,3)=0; A(1,2)=0;
G2 = digraph(A,names,'omitselfloops');
figure;
h2 = plot(G2)
h2 =
GraphPlot with properties: NodeColor: [0 0.4470 0.7410] MarkerSize: 4 Marker: 'o' EdgeColor: [0 0.4470 0.7410] LineWidth: 0.5000 LineStyle: '-' NodeLabel: {'alpha' 'beta' 'gamma' 'delta'} EdgeLabel: {} XData: [-0.4581 0.4581 0.9803 -0.9803] YData: [0.4581 -0.4581 0.9803 -0.9803] ZData: [0 0 0 0] Show all properties
% Ensure the node position does not change
h2.XData = h1.XData;
h2.YData = h1.YData;
  1 件のコメント
Keaton Ellis
Keaton Ellis 2022 年 8 月 29 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by