You can use matplotlib and a colormap for this. I think you need to create
a vp that's only for the colors, the documentation says which types are
accepted for colors. You can get a color with a cmap by pasing a value from
0 - 1.

See this example for using a cmap:

import matplotlib.pyplot as plt
cmap = plt.get_cmap('cool')
cmap(0.4)
(0.40000000000000002, 0.59999999999999998, 1.0, 1.0)



On Fri, Feb 26, 2016 at 12:35 PM, Alexandra Diem <[email protected]>
wrote:

> Hi,
> I'm trying to use graph-tool to track concentrations on a network and was
> wondering what the best way would be to obtain consistent colour scales for
> a vertex property? I track the concentration of a substance as a vertex
> property and then use that as the vertex_fill_color in graph_draw because I
> would like to visualise the change in concentration over the network over
> time. This works great, but it appears that every time I plot the graph the
> colormap is rescaled to the minimum and maximum values in the vertex
> property. So if my values range from 0.0 to 0.4 and I use the Blues
> colormap 0.0 is white and 0.4 is dark blue. If in the next time step my
> values range from 0.0 to 0.6 then 0.6 is dark blue and 0.4 is now a
> different shade of blue. Instead, if I know 0.0 would be the minimum value
> and 1.0 would be the maximum I would like to consistently plot my graphs
> using that scaling, so that 0.4 always has the same shade of blue. I hope
> this all made sense.
> Thanks!
> Alexandra
>
> _______________________________________________
> graph-tool mailing list
> [email protected]
> http://lists.skewed.de/mailman/listinfo/graph-tool
>
>
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to