apply_matplotlib_colors#
- apply_matplotlib_colors(G, src_attr, dest_attr, map, vmin=None, vmax=None, nodes=True)[source]#
Apply colors from a matplotlib colormap to a graph.
Reads values from the
src_attr
and use a matplotlib colormap to produce a color. Write the color todest_attr
.- Parameters:
- Gnx.Graph
The graph to read and compute colors for.
- src_attrstr or other attribute name
The name of the attribute to read from the graph.
- dest_attrstr or other attribute name
The name of the attribute to write to on the graph.
- mapmatplotlib.colormap
The matplotlib colormap to use.
- vminfloat, default None
The minimum value for scaling the colormap. If
None
, find the minimum value ofsrc_attr
.- vmaxfloat, default None
The maximum value for scaling the colormap. If
None
, find the maximum value ofsrc_attr
.- nodesbool, default True
Whether the attribute names are edge attributes or node attributes.