Skip to content

Commit 1afb662

Browse files
Backport PR #4056 on branch 1.12.x (docs: add inline example plot to sc.pl.pca_variance_ratio) (#4065)
Co-authored-by: Ekin Kahraman <evk23umu@uea.ac.uk>
1 parent ca8f391 commit 1afb662

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/scanpy/plotting/_tools/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,24 @@ def pca_variance_ratio(
206206
A string is appended to the default filename.
207207
Infer the filetype if ending on {`'.pdf'`, `'.png'`, `'.svg'`}.
208208
209+
Examples
210+
--------
211+
Plot the variance ratio for the first 30 PCs.
212+
213+
.. plot::
214+
:context: close-figs
215+
216+
import scanpy as sc
217+
adata = sc.datasets.pbmc3k_processed()
218+
sc.pl.pca_variance_ratio(adata)
219+
220+
Plot on a logarithmic scale.
221+
222+
.. plot::
223+
:context: close-figs
224+
225+
sc.pl.pca_variance_ratio(adata, log=True)
226+
209227
"""
210228
ranking(
211229
adata,

0 commit comments

Comments
 (0)