- spac.visualization.plot_ripley_l(adata, phenotypes, annotation=None, regions=None, sims=False, return_df=False, **kwargs)[source]
Plot Ripley’s L statistic for multiple bins and different regions for a given pair of phenotypes.
- Parameters:
adata (AnnData) – AnnData object containing Ripley’s L results in adata.uns[‘ripley_l’].
phenotypes (tuple of str) – A tuple of two phenotypes: (center_phenotype, neighbor_phenotype).
regions (list of str, optional) – A list of region labels to plot. If None, plot all available regions. Default is None.
sims (bool, optional) – Whether to plot the simulation results. Default is False.
return_df (bool, optional) – Whether to return the DataFrame containing the Ripley’s L results.
kwargs (dict, optional) – Additional keyword arguments to pass to seaborn.lineplot.
- Raises:
ValueError – If the Ripley L results are not found in adata.uns[‘ripley_l’].
- Returns:
ax (matplotlib.axes.Axes) – The Axes object containing the plot, which can be further modified.
df (pandas.DataFrame, optional) – The DataFrame containing the Ripley’s L results, if return_df is True.
Example
>>> ax = plot_ripley_l( ... adata, ... phenotypes=('Phenotype1', 'Phenotype2'), ... regions=['region1', 'region2']) >>> plt.show()
This returns the Axes object for further customization and displays the plot.