class documentation

Default Cairo drawer object for dendrograms.

Method __init__ Constructs the drawer and associates it to the given palette.
Method draw Draws the given Dendrogram in a Cairo context.
Instance Variable palette Undocumented
Static Method _item_box_size Calculates the amount of space needed for drawing an individual vertex at the bottom of the dendrogram.
Method _plot_item Plots a dendrogram item to the given Cairo context

Inherited from AbstractCairoDrawer:

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

Constructs the drawer and associates it to the given palette.

Parameters
contextthe context on which we will draw
bboxthe 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).
palettethe palette that can be used to map integer color indices to colors when drawing vertices
def draw(self, dendro, **kwds): (source)

Draws the given Dendrogram in a Cairo context.

Parameters
dendro

the igraph.Dendrogram to plot.

It accepts the following keyword arguments:

  • 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

Undocumented

@staticmethod
def _item_box_size(dendro, context, horiz, idx): (source)

Calculates the amount of space needed for drawing an individual vertex at the bottom of the dendrogram.

def _plot_item(self, dendro, context, horiz, idx, x, y): (source)

Plots a dendrogram item to the given Cairo context

Parameters
dendroUndocumented
contextthe Cairo context we are plotting on
horizwhether the dendrogram is horizontally oriented
idxthe index of the item
xthe X position of the item
ythe Y position of the item