cairo_draw#
- graph_tool.draw.cairo_draw(g, pos, cr, vprops=None, eprops=None, vorder=None, eorder=None, nodesfirst=False, vcmap=None, vcnorm=None, ecmap=None, ecnorm=None, loop_angle=nan, parallel_distance=None, res=0, size_units='output', max_render_time=-1, **kwargs)[git][source]#
Draw a graph to a
cairo.Context.- Parameters:
- g
Graph Graph to be drawn.
- pos
VertexPropertyMap Vector-valued vertex property map containing the x and y coordinates of the vertices.
- cr
Context A
Contextinstance. The raster images that are embedded in vector output (seegradient_renderin the edge properties ofgraph_draw()) have the fallback resolution of its target surface, which is 300 ppi by default, and can be changed withcairo.Surface.set_fallback_resolution().- 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.- vorder
VertexPropertyMap(optional, default:None) If provided, defines the relative order in which the vertices are drawn.
- eorder
EdgePropertyMap(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.- vcmap
matplotlib.colors.Colormapor tuple (optional, default:None) Vertex color map. Optionally, this may be a (
matplotlib.colors.Colormap, alpha) tuple. The values of scalar property maps are normalized to \([0, 1]\) (seevcnorm), except for integer or boolean values with amatplotlib.colors.ListedColormapof fewer than 256 colors (a qualitative colormap), in which case the distinct values are assigned the colors of the list in turn.- vcnorm
matplotlib.colors.Normalize(optional, default:None) An object which, when called, normalizes vertex property values into the \([0.0, 1.0]\) interval, before passing to the
vcmapcolormap.- ecmap
matplotlib.colors.Colormapor tuple (optional, default:None) Edge color map. Optionally, this may be a (
matplotlib.colors.Colormap, alpha) tuple. The values are mapped as forvcmap.- ecnorm
matplotlib.colors.Normalize(optional, default:None) An object which, when called, normalizes edge property values into the \([0.0, 1.0]\) interval, before passing to the
ecmapcolormap.- loop_anglefloat or
VertexPropertyMap(optional, default:numpy.nan) Angle used to draw self-loops. If
nanis 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.
- resfloat (optional, default:
0.) If shape sizes fall below this value, simplified drawing is used.
- size_units
"output"or"layout"(optional, default:"output") Units of the vertex and edge sizes (vertex and marker sizes, pen widths, font sizes, text distances and offsets, dash patterns). If
"output", they are in units of the output (e.g. pixels or points), independently of the transformation matrix ofcr. If"layout", they are in the same units as the positions, and are scaled together with them. The value ofresis always in output units.- 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_timemilliseconds.- vertex_*
VertexPropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
vertex_<prop-name>specify the vertex property with name<prop-name>, as an alternative to thevpropsparameter.- edge_*
EdgePropertyMapor arbitrary types (optional, default:None) Parameters following the pattern
edge_<prop-name>specify the edge property with name<prop-name>, as an alternative to theepropsparameter.
- g
- Returns:
- iterator
If
max_render_timeis nonnegative, this will be an iterator that will perform part of the drawing at each step, so that each iteration takes at mostmax_render_timemilliseconds.
See also
graph_drawDraw a graph to a file or an interactive window
draw_hierarchyDraw a nested block model hierarchy