Skip to content

Commit

Permalink
Add image examples to plots
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasMahieu committed Jun 19, 2024
1 parent f2adb33 commit 2e4f458
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/img/examples/bar_region.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/img/examples/hist_distribution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/crested/pl/_contribution_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def contribution_scores(
>>> seqs_one_hot = np.random.randint(0, 2, (1, 100, 4))
>>> class_names = ["class1"]
>>> crested.pl.contribution_scores(scores, seqs_one_hot, class_names)
.. image:: ../../../docs/_static/img/examples/contribution_scores.png
"""
# Center and zoom
_check_contrib_params(zoom_n_bases, scores)
Expand Down
2 changes: 2 additions & 0 deletions src/crested/pl/bar/_normalization_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def normalization_weights(adata: AnnData, **kwargs):
... height=3,
... title="Normalization scaling factors",
... )
.. image:: ../../../docs/_static/img/examples/bar_normalization_weights.png
"""

@log_and_raise(ValueError)
Expand Down
13 changes: 9 additions & 4 deletions src/crested/pl/bar/_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ def region_predictions(
-------
>>> crested.pl.bar.region_predictions(
... adata,
... region="chr1:10000-10500",
... model_names=["model1", "model2"],
... region='chr1:3094805-3095305'
... model_names=["model_1", "model_2"],
... share_y=False,
... title="Region chr1:3094805-3095305"
... )
.. image:: ../../../docs/_static/img/examples/bar_region_predictions.png
"""

@log_and_raise(ValueError)
Expand Down Expand Up @@ -133,13 +136,15 @@ def region(adata: AnnData, region: str, target: str = "groundtruth", **kwargs) -
-------
>>> crested.pl.bar.region(
... adata,
... region="chr1:10000-10500",
... region="chr1:3094805-3095305",
... target="groundtruth",
... xlabel="Cell Type",
... ylabel="Peak height",
... figsize=(20, 3),
... figtitle="Peak Heights",
... figtitle="chr1:3094805-3095305",
... )
.. image:: ../../../docs/_static/img/examples/bar_region.png
"""

@log_and_raise(ValueError)
Expand Down
7 changes: 6 additions & 1 deletion src/crested/pl/heatmap/_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ def correlations_self(
Examples
--------
>>> crested.pl.heatmap.correlations_self(
... adata, log_transform=True, title="Self Correlations"
... adata, log_transform=True, title="Self correlations heatmap"
... )
.. image:: ../../../docs/_static/img/examples/heatmap_self_correlations.png
"""
x = adata.X
classes = list(adata.obs_names)
Expand Down Expand Up @@ -126,8 +127,12 @@ def correlations_predictions(
... model_names=None,
... split="test",
... log_transform=True,
... vmin=0.4,
... vmax=0.85,
... title="Correlations: Predictions vs Ground Truth",
... )
.. image:: ../../../docs/_static/img/examples/heatmap_correlations_predictions.png
"""

@log_and_raise(ValueError)
Expand Down
2 changes: 2 additions & 0 deletions src/crested/pl/hist/_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def distribution(
>>> crested.pl.hist.distribution(
... adata, split="test", share_y=False, class_names=["Astro", "Vip"]
... )
.. image:: ../../../docs/_static/img/examples/hist_distribution.png
"""

@log_and_raise(ValueError)
Expand Down
3 changes: 3 additions & 0 deletions src/crested/pl/scatter/_class_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ def class_density(
Example
-------
>>> crested.pl.scatter.class_density(
... adata,
... class_name="Astro",
... model_names=["model1", "model2"],
... split="test",
... log_transform=True,
... )
.. image:: ../../../docs/_static/img/examples/scatter_class_density.png
"""

@log_and_raise(ValueError)
Expand Down

0 comments on commit 2e4f458

Please sign in to comment.