python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class CairoMatrixDrawer(AbstractCairoDrawer):

View In Hierarchy

Default Cairo drawer object for matrices.

Method __init__ Constructs the vertex drawer and associates it to the given palette.
Method draw Draws the given Matrix in a Cairo context.
Instance Variable bbox The bounding box of the drawing area where this drawer will draw.

Inherited from AbstractCairoDrawer:

Instance Variable context Undocumented
Method bbox.setter Sets the bounding box of the drawing area where this drawer will draw.
Instance Variable _bbox Undocumented
Method _mark_point Marks the given point with a small circle on the canvas. Used primarily for debugging purposes.
def __init__(self, context):

Constructs the vertex drawer and associates it to the given palette.

Parameterscontextthe context on which we will draw
def draw(self, matrix, **kwds):

Draws the given Matrix in a Cairo context.

Parametersmatrixthe igraph.Matrix to plot.

It accepts the following keyword arguments:

  • bbox: the bounding box within which we will draw. Can be anything accepted by the constructor of BoundingBox (i.e., a 2-tuple, a 4-tuple or a BoundingBox object).
  • palette: the palette that can be used to map integer color indices to colors when drawing vertices
  • style: the style of the plot. boolean is useful for plotting matrices with boolean (True/False or 0/1) values: False will be shown with a white box and True with a black box. palette uses the given palette to represent numbers by colors, the minimum will be assigned to palette color index 0 and the maximum will be assigned to the length of the palette. None draws transparent cell backgrounds only. The default style is boolean (but it may change in the future). None values in the matrix are treated specially in both cases: nothing is drawn in the cell corresponding to None.
  • square: whether the cells of the matrix should be square or not. Default is True.
  • grid_width: line width of the grid shown on the matrix. If zero or negative, the grid is turned off. The grid is also turned off if the size of a cell is less than three times the given line width. Default is 1. Fractional widths are also allowed.
  • border_width: line width of the border drawn around the matrix. If zero or negative, the border is turned off. Default is 1.
  • row_names: the names of the rows
  • col_names: the names of the columns.
  • values: values to be displayed in the cells. If None or False, no values are displayed. If True, the values come from the matrix being plotted. If it is another matrix, the values of that matrix are shown in the cells. In this case, the shape of the value matrix must match the shape of the matrix being plotted.
  • value_format: a format string or a callable that specifies how the values should be plotted. If it is a callable, it must be a function that expects a single value and returns a string. Example: "%#.2f" for floating-point numbers with always exactly two digits after the decimal point. See the Python documentation of the % operator for details on the format string. If the format string is not given, it defaults to the str function.

If only the row names or the column names are given and the matrix is square-shaped, the same names are used for both column and row names.

kwdsUndocumented
bbox =

The bounding box of the drawing area where this drawer will draw.

API Documentation for python-igraph, generated by pydoctor 21.2.2 at 2021-10-18 16:23:19.