How to color a graph that is shown below?
3 ビュー (過去 30 日間)
古いコメントを表示
I have graph below that was generated by the following code:
Also the data.xlsx has the matrix used below.
nodes = [];
new_matrix(:,1:2) = matrix(:,1:2);
for i = 1:1:size(matrix,1)
if matrix(i,4) <= 10000
nodes = [nodes,matrix(i,1:2)];
% new_matrix(i,1:2) = 0;
new_matrix(i,3) = 1;
else
% new_matrix(i,1:2) = 0;
new_matrix(i,3) = 0;
end
end
%
nodes_cellarray{:} = nodes;
set(figure, 'Visible', 'on');
G = graph(matrix(:,1),matrix(:,2));
plot_array = plot(G, 'layout', 'auto');
% plot_array.NodeColor = 'white';
highlight(plot_array,nodes_cellarray{:},'EdgeColor','r','NodeColor','red','LineWidth',4);
I get a graph plot as shown here:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257829/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257829/image.jpeg)
I am aiming to color this graph such that it should look like the colorplot below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257830/image.jpeg)
This is a MATLAB generated plot from a research artcle.
15 件のコメント
Walter Roberson
2020 年 1 月 4 日
編集済み: Walter Roberson
2020 年 1 月 4 日
You have Node A as an integer, and given the node number and your numbering diagram, you can translate the node number into X and Y coordinates.
Likewise you have Node B that can be translated into X and Y coordinates.
But what does the Weight column convey ? You have an edge with finite value, and those edges are always either adjacent to each other horizontally or vertically, but what should be done with the weight value?
Like do the inf entries mark nucleation, and I should be plotting those as yellow instead of discarding them? If so then that would not agree with the pattern in the last part of the file, where every 4th entry is reliably inf.
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!