arcfish.pl.triangle_heatmap#

arcfish.pl.triangle_heatmap(mat: ndarray, df1d: DataFrame, cut_hi: None | float = None, cmap: str | Colormap = 'RdBu', hue_norm: None | Normalize = None, fig: None | Figure = None, width: float = 3, height: None | float = None, alpha: float = 0.8, marker: str = 'd', s: float = None, xticklabels: None | list[str] = None) Tuple[Figure, Axes, Axes]#

Plot a heatmap in the upper right triangle of a 2D matrix.

fig, width, height:

  1. If fig is not None, no need to pass in width and height.

2. If width is not None, no need to pass in fig. In this case, if height is None, infer height from width and cut_hi. If height is not None, use height as the height of the figure.

Parameters:
  • mat (np.ndarray) – p by p matrix to plot.

  • df1d (pd.DataFrame) – 1D genomic location information. Must contain “Chrom_Start” and “Chrom_End” as columns. Can first call arcfish.pp.FOF_CT_Loader.create_adata() to create an adata object and then use the var field as df1d.

  • cut_hi (None | float, optional) – Only pixels with 1D genomic distance below cut_hi will be plotted. Plot all pixels if cut_hi is None, by default None.

  • cmap (str | mcolors.Colormap, optional) – Color map used, can be either a string or a Colormap object created by get_cmap(), by default “RdBu”.

  • hue_norm (None | mcolors.Normalize, optional) – Normalization for the color map, by default None. If None, use the min and max of the data to normalize the color map.

  • fig (None | plt.Figure, optional) – Figure object to plot the heatmap, by default None.

  • width (float, optional) – Width of the figure, by default 3.

  • height (None | float, optional) – Height of the figure, by default None.

  • marker (str, optional) – Marker to use for the scatter plot, by default “d”.

  • s (float, optional) – Size of the marker, by default None. If None, set to width*15.

  • alpha (float, optional) – Transparency of pixels, by default 0.8.

  • xticklabels (None | list[str], optional) – List of length 2, xtick labels. If None, set the xtick labels as 1D genomic locations with unit Mb, by default None.

Returns:

Figure, main ax, and colorbar ax.

Return type:

Tuple[plt.Figure, plt.Axes, plt.Axes]