scatlastb_utils.pl.qc_joint

Contents

scatlastb_utils.pl.qc_joint#

scatlastb_utils.pl.qc_joint(adata, x, y, log_x=1, log_y=1, hue=None, main_plot_function=None, main_plot_kwargs=None, marginal_plot_function=None, marginal_hue=None, x_threshold=None, y_threshold=None, title='', return_df=False, marginal_kwargs=None, **kwargs)#

Plot scatter plot with marginal histograms from df columns.

This function wraps the seaborn.JointGrid function

Parameters:
  • adata (AnnData) – AnnData object containing axes to be plotted in joint plot.

  • x (str) – Column in adata.obs for x axis.

  • y (str) – Column in adata.obs for y axis.

  • log_x (int (default: 1)) – Log base for transforming x axis before plotting. Default 1, no transformation.

  • log_y (int (default: 1)) – Log base for transforming y axis before plotting. Default 1, no transformation.

  • hue (str (default: None)) – Column in adata.obs with annotations for color coding scatter plot points.

  • main_plot_function (Callable (default: None)) – Function to use for the main joint plot. Defaults to seaborn.scatterplot.

  • marginal_plot_function (Callable (default: None)) – Function to use for the marginal plot passed to seaborn’s JointGrid.plot_marginals function

  • marginal_kwargs (dict (default: None)) – Additional keyword arguments passed to the marginal plots (histograms/KDEs).

  • x_threshold (default: None) – Tuple of upper and lower filter thresholds for x axis.

  • y_threshold (default: None) – Tuple of upper and lower filter thresholds for y axis.

  • title (default: '') – Title text for plot.

  • return_df (default: False) – If True, return the DataFrame used for plotting along with the JointGrid.

  • **kwargs – Additional keyword arguments passed to the main plot function.

  • main_plot_kwargs (dict)

  • marginal_hue (str)

Returns:

g

A seaborn.axisgrid.JointGrid object.

out_df

A pandas.DataFrame with updated values. Only returned if return_df is True.

Examples

import scanpy as sc
import scatlastb_utils as atl

adata = sc.datasets.pbmc68k_reduced()
atl.pl.qc_joint(
    adata,
    x="n_genes",
    y="n_counts",
    hue="bulk_labels",
    # additional kwargs to pass to main_plot_function
    s=10,
    alpha=0.5,
)
../_images/scatlastb_utils-pl-qc_joint-1.png