FACSPy.pl.biax

Contents

FACSPy.pl.biax#

FACSPy.pl.biax(adata, gate, layer, x_channel, y_channel, sample_identifier=None, color='density', add_cofactor=False, x_scale=None, y_scale=None, color_scale='linear', cmap=None, vmin=None, vmax=None, title=None, figsize=(4, 4), return_dataframe=False, return_fig=False, ax=None, show=True, save=None, **kwargs)#

Plot for normal biaxial representation of cytometry data.

Color the plot using annotations of observations (.obs) or expression of markers. Axes are customizable to log, biex or linear scale.

Parameters:
  • adata (AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channels

  • gate (str) – The gate to be analyzed, called by the population name. This parameter has a default stored in fp.settings, but can be superseded by the user.

  • layer (str) – The layer corresponding to the data matrix. Similar to the gate parameter, it has a default stored in fp.settings which can be overwritten by user input.

  • x_channel (str) – The channel that is plotted on the x axis.

  • y_channel (str) – The channel that is plotted on the y axis

  • sample_identifier (Optional[str]) – Controls the data that are extracted. Defaults to None. If set, has to be one of the sample_IDs or the file_names.

  • color (Optional[Union`[:py:class:`str, Literal['density']]]) – The parameter that controls the coloring of the plot. Can be set to categorical variables from the .obs slot or continuous variables corresponding to channels. Default is set to ‘density’, which calculates the point density in the plot.

  • add_cofactor (Union[Literal['x', 'y', 'both'], bool]) – if set, adds the cofactor as a line to the plot for visualization. if x, sets the cofactor for the x-axis, if y, sets the cofactor for the y-axis, if both, sets both axis cofactors

  • x_scale (Optional[Literal['biex', 'log', 'linear']]) – sets the scale for the x axis. Has to be one of biex, log, linear. The value biex gets converted to symlog internally

  • y_scale (Optional[Literal['biex', 'log', 'linear']]) – sets the scale for the y axis. Has to be one of biex, log, linear. The value biex gets converted to symlog internally

  • color_scale (Literal['biex', 'log', 'linear']) – sets the scale for the colorbar. Has to be one of biex, log, linear.

  • cmap (Optional[str]) – Sets the colormap for plotting. Can be continuous or categorical, depending on the input data. When set, both seaborns palette and cmap parameters will use this value

  • vmin (Optional[Union`[:py:class:`float, int]]) – minimum value to plot in the color vector

  • vmax (Optional[Union`[:py:class:`float, int]]) – maximum value to plot in the color vector

  • title (Optional[str]) – sets the figure title. Optional

  • figsize (tuple[float, float]) – Contains the dimensions of the final figure as a tuple of two ints or floats.

  • return_dataframe (bool) – If set to True, returns the raw data that are used for plotting as a dataframe.

  • return_fig (bool) – If set to True, the figure is returned.

  • ax (Optional[Axes]) – A Axes created from matplotlib to plot into.

  • show (bool) – Whether to show the figure. Defaults to True.

  • save (Optional[str]) – Expects a file path including the file name. Saves the figure to the indicated path. Defaults to None.

  • kwargs – keyword arguments that will ultimately passed to sns.scatterplot().

Return type:

Optional[Figure, Axes, DataFrame]]

Returns:

  • If show==False a Axes

  • If return_fig==True a Figure

  • If return_dataframe==True a DataFrame containing the data used for plotting

Examples

import FACSPy as fp

dataset = fp.mouse_lineages()

fp.pl.biax(
    dataset,
    gate = "CD45+",
    layer = "compensated",
    x_channel = "Ly6G",
    y_channel = "SSC-A",
    color = "density",
    x_scale = "biex",
    y_scale = "linear"
)
../_images/FACSPy-pl-biax-1.png