Hi,
I have plotted a graph with n nodes.
Each node has an "attribute" or a value from -1 to 1 stored in a vector K.
I would like to color the nodes using these attributes so for example if node 1 has attribute value "-1" then with the "JET" colormap on Matlab it would appear in Blue.
Is there a way to achieve this ?
I tried the following but clearly it doesn't work (returns error, it's wrong):
jetcustom=jet(n); r1=K(1,:); %list of attributes
colors = interp1(linspace(-1, 1, n), jetcustom, r1.');figure()a=graph(A);p=plot(a,'Layout','force');for i=1:n highlight(p,i , 'NodeColor', colors(i));end
Best Answer