Skip to content

Commit f39ea76

Browse files
Ekin-Kahramanmeeseeksmachine
authored andcommitted
Backport PR scverse#4056: docs: add inline example plot to sc.pl.pca_variance_ratio
1 parent ca8f391 commit f39ea76

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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)