Plotting functions

Plotting functions for variant call data.

Variant location

allel.plot.variant_locator(pos, step=None, ax=None, start=None, stop=None, flip=False, line_kwargs=None)[source]

Plot lines indicating the physical genome location of variants from a single chromosome/contig. By default the top x axis is in variant index space, and the bottom x axis is in genome position space.

Parameters:

pos : array_like

A sorted 1-dimensional array of genomic positions from a single chromosome/contig.

step : int, optional

Plot a line for every step variants.

ax : axes, optional

The axes on which to draw. If not provided, a new figure will be created.

start : int, optional

The start position for the region to draw.

stop : int, optional

The stop position for the region to draw.

flip : bool, optional

Flip the plot upside down.

line_kwargs : dict-like

Additional keyword arguments passed through to plt.Line2D.

Returns:

ax : axes

The axes on which the plot was drawn

Pairwise distance

allel.plot.pairwise_distance(dist, labels=None, colorbar=True, ax=None, imshow_kwargs=None)[source]

Plot a pairwise distance matrix.

Parameters:

dist : array_like

The distance matrix in condensed form.

labels : sequence of strings, optional

Sample labels for the axes.

colorbar : bool, optional

If True, add a colorbar to the current figure.

ax : axes, optional

The axes on which to draw. If not provided, a new figure will be created.

imshow_kwargs : dict-like, optional

Additional keyword arguments passed through to matplotlib.pyplot.imshow().

Returns:

ax : axes

The axes on which the plot was drawn

Linkage disequilibrium

allel.plot.pairwise_ld(m, colorbar=True, ax=None, imshow_kwargs=None)[source]

Plot a matrix of linkage disequilibrium values between pairs of variants.

Parameters:

m : array_like

LD matrix in condensed form.

colorbar : bool, optional

If True, add a colorbar to the current figure.

ax : axes, optional

The axes on which to draw. If not provided, a new figure will be created.

imshow_kwargs : dict-like, optional

Additional keyword arguments passed through to matplotlib.pyplot.imshow().

Returns:

ax : axes

The axes on which the plot was drawn