plot_alignment
#
- biotite.sequence.graphics.plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50, show_numbers=False, number_size=None, number_functions=None, labels=None, label_size=None, show_line_position=False, spacing=1, symbol_spacing=None)[source]#
Plot a pairwise or multiple sequence alignment.
The output is similar to a string representation of an
Alignment
, but with enhanced styling, symbol coloring and optional sequence labels and sequence position numbering. How each symbol of the alignment is drawn is determined by the givenSymbolPlotter
object.- Parameters:
- axesAxes
A Matplotlib axes, that is used as plotting area.
- alignmentAlignment
The pairwise or multiple sequence alignment to be plotted.
- symbol_plotterSymbolPlotter
Defines how the symbols in the alignment are drawn.
- symbols_per_lineint, optional
The amount of alignment columns that are diplayed per line.
- show_numbersbool, optional
If true, the sequence position of the symbols in the last alignment column of a line is shown on the right side of the plot. If the last symbol is a gap, the position of the last actual symbol before this gap is taken. If the first symbol did not occur up to this point, no number is shown for this line. By default the first symbol of a sequence has the position 1, but this behavior can be changed using the number_functions parameter.
- number_sizefloat, optional
The font size of the position numbers
- number_functionslist of [(None or Callable(int -> int)], optional
By default the position of the first symbol in a sequence is 1, i.e. the sequence position is the sequence index incremented by 1. The behavior can be changed with this parameter: If supplied, the length of the list must match the number of sequences in the alignment. Every entry is a function that maps a sequence index (int) to a sequence position (int) for the respective sequence. A
None
entry means, that the default numbering is applied for the sequence.- labelslist of str, optional
The sequence labels. Must be the same size and order as the sequences in the alignment.
- label_sizefloat, optional
Font size of the labels
- show_line_positionbool, optional
If true the position within a line is plotted below the alignment.
- spacingfloat, optional
The spacing between the alignment lines. 1.0 means that the size is equal to the size of a symbol box.
- symbol_spacingint, optional
А space is placed between each number of elements desired by variable.
Notes
The labels are placed on the Y-axis of the axes and the numbers are placed on the Y-axis of the axes twin. The position within a line is placed on the X-axis of the axes. Further modification of these can be performed using the usual Matplotlib API.
Gallery#

Customized visualization of a multiple sequence alignment