help > Node colors: min and max values
Showing 1-2 of 2 posts
Display:
Results per page:
Feb 2, 2017  01:02 PM | Ezequiel Mikulan
Node colors: min and max values
Hello, I'm trying to make several plots using the same colorbar range for the nodes. I saw that there is an entry in the forum that shows how to do it on edges (https://www.nitrc.org/forum/message.php?...) but I can't find how to do it on nodes. Is there any way to do it?

Thank you in advance for your help and thanks for a great tool!
Feb 4, 2017  08:02 AM | Mingrui Xia
RE: Node colors: min and max values
Hi, 

The codes for adjusting nodal color are located at about line 552, function NodePrepare, in BrainNet.m:

original codes:
surf.sphere(:,6)=surf.sphere(:,4);
if min(surf.sphere(:,6))<0
surf.sphere(:,6)=surf.sphere(:,6)-min(surf.sphere(:,6));
end
if min(surf.sphere(:,6))<1
surf.sphere(:,6)=surf.sphere(:,6)+1;
end
while max(surf.sphere(:,6))/min(surf.sphere(:,6))>10    %non-linear transfer
surf.sphere(:,6)=log(surf.sphere(:,6));
if min(surf.sphere(:,6))<1
surf.sphere(:,6)=surf.sphere(:,6)+1;
end
end
if max(surf.sphere(:,6))~=min(surf.sphere(:,6))  % linear transfer
EC.nod.k=63/(max(surf.sphere(:,6))-min(surf.sphere(:,6)));
EC.nod.b=64-EC.nod.k*max(surf.sphere(:,6));
else
EC.nod.k=0;
EC.nod.b=1;
end
surf.sphere(:,6)=surf.sphere(:,6)*EC.nod.k+EC.nod.b;

Please comment the non-linear parts, and modify the linear transfer part as (suppose the fixed scale is -5 ~ 5): 
if max(surf.sphere(:,6))~=min(surf.sphere(:,6))
EC.nod.k=63/10;                                              %10 represent 5 - (-5)
EC.nod.b=64-EC.nod.k*5;                                  %5 represent the high end of colorbar
else
EC.nod.k=0;
EC.nod.b=1;
end 

Best,
Mingrui