alphagenome.visualization.plot.plot_track

Contents

alphagenome.visualization.plot.plot_track#

alphagenome.visualization.plot.plot_track(arr, ax, x=None, legend=False, ylim=None, color=None, filled=False)[source]#

Plot a single track on the axis after inferring track type from array.

This function infers the type of track plot depending on channel dimensionality of arr:

  • If arr is a single-dimensional array, plot a single track line.

  • If arr is a 2D array, and interpreting the second dimension as the channel dimension:

    • Plot a sequence logo if the number of channels is 4 (which suggests one channel per DNA base).

    • Plot two overlapping line plots if the number of channels is 2 (which suggests one channel per DNA strand).

Parameters:
  • arr (ndarray) – array of values to plot.

  • ax (Axes) – matplotlib axis to use for plotting the values on.

  • x (Optional[ndarray] (default: None)) – optional array of values to use for setting the x axis values. If absent, then sequential values starting from 1 to the length of the array arr will be used.

  • legend (bool (default: False)) – whether to draw a legend or not on the double stranded DNA plot.

  • ylim (Optional[float] (default: None)) – y axis limit.

  • color (Union[str, Sequence[str], None] (default: None)) – color(s) used for line plots.

  • filled (bool (default: False)) – whether to fill the space between the x axis and the line (or leave it as whitespace).

Return type:

None

Returns:

None. Adds a plot to the provided axis.