graph_tool.draw.cairo_draw#

graph_tool.draw.cairo_draw(g, pos, cr, vprops=None, eprops=None, vorder=None, eorder=None, nodesfirst=False, vcmap=None, ecmap=None, loop_angle=nan, parallel_distance=None, res=0, max_render_time=-1, **kwargs)[source]#

Draw a graph to a cairo context.

Parameters:
gGraph

Graph to be drawn.

posVertexPropertyMap

Vector-valued vertex property map containing the x and y coordinates of the vertices.

crContext

A Context instance.

vpropsdict (optional, default: None)

Dictionary with the vertex properties. Individual properties may also be given via the vertex_<prop-name> parameters, where <prop-name> is the name of the property.

epropsdict (optional, default: None)

Dictionary with the edge properties. Individual properties may also be given via the edge_<prop-name> parameters, where <prop-name> is the name of the property.

vorderVertexPropertyMap (optional, default: None)

If provided, defines the relative order in which the vertices are drawn.

eorderEdgePropertyMap (optional, default: None)

If provided, defines the relative order in which the edges are drawn.

nodesfirstbool (optional, default: False)

If True, the vertices are drawn first, otherwise the edges are.

vcmapmatplotlib.colors.Colormap or tuple (optional, default: None)

Vertex color map. Optionally, this may be a (matplotlib.colors.Colormap, alpha) tuple.

ecmapmatplotlib.colors.Colormap or tuple (optional, default: None)

Edge color map. Optionally, this may be a (matplotlib.colors.Colormap, alpha) tuple.

loop_anglefloat or EdgePropertyMap (optional, default: numpy.nan)

Angle used to draw self-loops. If nan is given, they will be placed radially from the center of the layout.

parallel_distancefloat (optional, default: None)

Distance used between parallel edges. If not provided, it will be determined automatically.

bg_colorstr or sequence (optional, default: None)

Background color. The default is transparent.

resfloat (optional, default: 0.):

If shape sizes fall below this value, simplified drawing is used.

max_render_timeint (optional, default: -1):

If nonnegative, this function will return an iterator that will perform part of the drawing at each step, so that each iteration takes at most max_render_time milliseconds.

vertex_*VertexPropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern vertex_<prop-name> specify the vertex property with name <prop-name>, as an alternative to the vprops parameter.

edge_*EdgePropertyMap or arbitrary types (optional, default: None)

Parameters following the pattern edge_<prop-name> specify the edge property with name <prop-name>, as an alternative to the eprops parameter.

Returns:
iterator

If max_render_time is nonnegative, this will be an iterator that will perform part of the drawing at each step, so that each iteration takes at most max_render_time milliseconds.