I wrote a for loop to convert the graph into a matrix that represents the weights of the edges.
See below (left: heatmap and the right one is the older graph)

clc
clear all
close all
% A= data imported
% A = xlsread('data.xlsx');
A = xlsread('matrix22.xlsx');
A(isnan(A)) = inf;
matrix = A;
nodes_x = 51;
nodes_y = nodes_x;
% A = A(:,:);
[r_A,c_A]= size(A); %getting row and column dimension of A
%max_A=max(A,[],2).'; %column vector of maximum node number to get max node number
%max_A(3)= max_A(4)= 0; %3,4 column is garbage
%max_A=max(max_A); %gives you the maximum node number
%dim_res= sqrt(max_A); %getting dimension of matrix C
dim_res=nodes_x;
B = zeros(r_A,4); % B will be the direction matrix ie B[;,1]= row number of each point B[;,2]= column number of each point B[;,3]= difference number of each point B[;,4]= weight value of each point
for i=1:r_A
B(i,1)=2*floor(A(i,1)/dim_res)+1; %row of each point cells are left to fill in edges
B(i,2)=2*mod(A(i,1),dim_res)+1; %column of each point cells are left to fill in edges
B(i,3)=A(i,2)-A(i,1); % direction vector of each point
B(i,4)=A(i,4);%assuming column 4 is the required column
end
C=zeros(101,99);
for i=1:r_A
if B(i,3)==1
C(B(i,1),B(i,2)+1)=B(i,4);% if the node is the next node, it should put the value in the adjacent cell in the same row
elseif B(i,3) == nodes_x
C(B(i,1)+1,B(i,2))=B(i,4);
end
end
%%
C(1,:) = [];
C(size(C,1)-1:size(C,1),:) = [];
C(:,1:2) = [];
%5 heatmap
h = heatmap(C,'Colormap', winter);
h.Colormap = parula;
h.ColorScaling = 'scaled';
h.ColorLimits = [0 10000];
h.GridVisible = 'off';
h.MissingDataColor = [0.8 0.8 0.8];
h.Title = 'Phase matrixs';
h.XLabel = '';
h.YLabel = '';
% caxis(h,[0 1]);
%% graph plot
%
nodes = [];
for i = 1:1:size(matrix,1)
if matrix(i,4) <= 10000
nodes = [nodes,matrix(i,1:2)];
end
end
nodes_cellarray{:} = nodes;
set(figure, 'Visible', 'on');
Graph = graph(matrix(:,1),matrix(:,2));
plot_array = plot(Graph, 'layout', 'auto');
highlight(plot_array,nodes_cellarray{:},'EdgeColor','r','NodeColor','r','LineWidth',4);
%
15 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782347
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782347
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782351
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782351
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782551
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782551
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782659
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782659
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782665
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782665
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782674
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782674
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782675
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782675
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782886
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782886
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782903
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782903
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782911
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782911
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782912
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782912
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782913
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782913
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782929
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782929
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782950
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782950
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782952
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/498629-how-to-color-a-graph-that-is-shown-below#comment_782952
Sign in to comment.