|
From: | Daniele Notarmuzi |
Subject: | Re: [igraph] Color of nodes and edges according to numbers |
Date: | Tue, 30 May 2017 13:59:28 +0200 |
Hi,This question was already answered here on the mailing list:T.On Tue, May 30, 2017 at 12:34 PM, Daniele Notarmuzi <address@hidden> wrote:______________________________Good morning,I use python 2.7.5 on ubuntu 14.04 and python-igraph 0.6.5I have the following problem: I have a network with N nodes and and array of N numbers, each between O and 1.I need:1) the color of nodes i and j has to be the same if array[i] == array[j]2) the color of edge ij has to be given according to this criterion:if( array[i] <= array[j] ):color_of_edge_ij = color_of_node_jelse:color_of_egde_ij = color of node_jAbout the first question I was suggested here (https://lists.nongnu.org/archive/html/igraph-help/2011-04/m )sg00043.html to assign manually the color to each node:g.vs[0]["color"] = "red"g.vs[1]["color"] = "blue"...g.vs[N]["color"] = "black"then I can dofor i in (0,N):for j in (i+1,N):if (array[i] == array[j]):g.vs[i]["color"] = g.vs[j]["color"]This works but if N is a big number is not practicable to assign manually a color to each node.About the second question, I'vs tried to adapt the code into my case but the best I obtained was two different colors.In practice, I need a way to have univocal correspondence between numbers in [0,1] and colors. How can I obtain this? (maybe using palette?)thanks in advance._________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |