spateo.plotting.static.glm#

Module Contents#

Functions#

glm_fit(adata, gene, list] = None, feature_x, ...)

Visualize the glm_degs result.

spateo.plotting.static.glm.glm_fit(adata: anndata.AnnData, gene: Union[str, list] = None, feature_x: str = None, feature_y: Optional[str] = 'expression', feature_fit: Optional[str] = 'mu', glm_key: str = 'glm_degs', lowess: bool = False, frac: float = 0.1, show_ci: bool = True, show_legend: bool = True, point_size: float = 1, point_color: Union[str, numpy.ndarray, list] = 'skyblue', line_size: float = 1, line_color: str = 'black', ci_color: str = 'gainsboro', ci_alpha: float = 0.7, ax_size: Union[tuple, list] = (3, 3), background_color: str = 'white', ncols: int = 4, save_show_or_return: Literal[save, show, return, both, all] = 'show', save_kwargs: Optional[dict] = None, **kwargs)[source]#

Visualize the glm_degs result.

Parameters
adata

An Anndata object contain glm_degs result in .uns[glm_key].

gene

A gene name or a list of genes that will be used to plot.

feature_x

The key in .uns[glm_key]['correlation'][gene] that corresponds to the independent variables, such as 'torsion', etc.

feature_y

The key in .uns[glm_key]['correlation'][gene] that corresponds to the dependent variables, such as 'expression', etc.

feature_fit

The key in .uns[glm_key]['correlation'][gene] that corresponds to the fitted values, such as 'mu', etc.

glm_key

The key in .uns that corresponds to the glm_degs result.

lowess

Locally Weighted Scatter-plot Smoothing. Whether to use the lowess function on the feature_y value.

frac

Between 0 and 1. The fraction of the data used when estimating each feature_y-value. Only valid when lowess is True.

show_ci

Whether to show the confidence interval.

show_legend

Whether to show the legend.

point_size

The scale of the feature_y point size.

point_color

The color of the feature_y point.

line_size

The scale of the fitted line width.

line_color

The color of the fitted line.

ci_color

The color of the confidence interval.

ci_alpha

The transparency of the ci_color.

ax_size

The width and height of each ax.

background_color

The background color of the figure.

ncols

Number of columns for the figure.

save_show_or_return

If 'both', it will save and plot the figure at the same time.

If 'all', the figure will be saved, displayed and the associated axis and other object will be return.

save_kwargs

A dictionary that will be passed to the save_fig function.

By default, it is an empty dictionary and the save_fig function will use the {"path": None, "prefix": 'scatter', "dpi": None, "ext": 'pdf', "transparent": True, "close": True, "verbose": True} as its parameters.

Otherwise, you can provide a dictionary that properly modify those keys according to your needs.

**kwargs

Additional parameters that will be passed into the statsmodels.nonparametric.smoothers_lowess.lowess function.