On 17.11.2014 11:56, Leonardo Chiquitto wrote:
> While pinning the vertices' positions is trivial, I couldn't find a
> nice solution to "pin the colors": every time a new color is used,
> the normalization process picks new colors for all vertices,
> giving the false impression that the algorithm has changed them.

The colors do not have to be simple scalar values, they can also be
strings such as "green" or "#00FF00" or RGBA vectors such as [0., 1.,
0., 1.]. That means you can set the color by hand, and avoid the
normalization. For example:

color = g.new_vertex_property("vector<double>")
color[g.vertex(0)] = [.1, .9, .1, 1.]
color[g.vertex(1)] = [.9, .0, .1, 1.]
...
graph_draw(g, vertex_fill_color=color)

Another option is to construct your own colormap, and pass it as the
vcmap parameter. You can learn more about color maps here:

    http://matplotlib.org/users/colormaps.html

Best,
Tiago

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to