alphagenome.visualization.plot.plot_tracks

Contents

alphagenome.visualization.plot.plot_tracks#

alphagenome.visualization.plot.plot_tracks(tracks, x=None, title=None, legend=False, fig_width=20, fig_track_height=1.5, ylim='auto', yticks_min_max_only=False, ylab=True, color=None, horizontal_ylab=True, filled_tracks=None, despine=True, despine_keep_bottom=False, plot_track_fn=<function plot_track>)[source]#

Plot multiple tracks as subplots within one matplotlib figure.

Custom plotting functions may be passed as plot_track_fn. Otherwise, plot_track will be used by default.

Parameters:
  • tracks (Mapping[str, Any]) – dictionary of tracks to plot. Example input: tracks = {‘a’: [1,2,3], ‘b’: [4,5,4]}. The arrays in the dict must have the same length.

  • x (Optional[ndarray] (default: None)) – optional array of x axis values. If absent, these will be inferred to be from 1 to the length of the arrays in tracks.

  • title (Optional[str] (default: None)) – Optional title to be added to the first subplot in the figure.

  • legend (bool (default: False)) – Whether to plot a legend or not.

  • fig_width (float (default: 20)) – Figure width.

  • fig_track_height (float | Mapping[str, float] (default: 1.5)) – Either a scalar specifying the total height of the figure, or a dictionary specifying the height of the subplot for each track.

  • ylim (str | Mapping[str, tuple[int, int]] | tuple[int, int] | None (default: 'auto')) – y axis limit. Must be either “same” (shared y limit across subplots) or “auto” (free scales, indicating separate limits per subplot).

  • yticks_min_max_only (bool (default: False)) – whether the only y axis ticks should be the min and max values.

  • ylab (bool (default: True)) – y axis label.

  • color (Union[str, Mapping[str, str], None] (default: None)) – Either a string or a dict indicating a color per track.

  • horizontal_ylab (bool (default: True)) – Whether to display the y axis label horizontally (instead of the default vertical orientation).

  • filled_tracks (Optional[Sequence[str]] (default: None)) – List of track names that should have filled line plots drawn (instead of the default whitespace between the values and x axis).

  • despine (bool (default: True)) – Whether to remove top, right, and bottom spines.

  • despine_keep_bottom (bool (default: False)) – Whether to remove top and right spines, but keep the bottom spine.

  • plot_track_fn (Callable[..., Any] (default: <function plot_track at 0x743c7b322c20>)) – Optional custom function for plotting tracks. If absent, defaults to plot_track.

Return type:

Figure

Returns:

Matplotlib figure.