Skip to content

Commit 3b82349

Browse files
committed
docs: add inline example plot to sc.pl.pca_variance_ratio
Part of #1664. Adds rendered plot examples showing the PCA variance ratio on PBMC 3k data, including the log scale variant.
1 parent 1f9b5ca commit 3b82349

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
@@ -202,6 +202,24 @@ def pca_variance_ratio(
202202
A string is appended to the default filename.
203203
Infer the filetype if ending on {`'.pdf'`, `'.png'`, `'.svg'`}.
204204
205+
Examples
206+
--------
207+
Plot the variance ratio for the first 30 PCs.
208+
209+
.. plot::
210+
:context: close-figs
211+
212+
import scanpy as sc
213+
adata = sc.datasets.pbmc3k_processed()
214+
sc.pl.pca_variance_ratio(adata)
215+
216+
Plot on a logarithmic scale.
217+
218+
.. plot::
219+
:context: close-figs
220+
221+
sc.pl.pca_variance_ratio(adata, log=True)
222+
205223
"""
206224
ranking(
207225
adata,

0 commit comments

Comments
 (0)