Skip to content

Add more information on how to save plots #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _issues.ipynb
figures/*
data/*
write/*
plotting/CD79A.png

*.egg-info/
.pytest_cache/
Expand Down
13 changes: 13 additions & 0 deletions basic-scrna-tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,19 @@
"sc.pl.umap(adata, color=[\"leiden\"])"
]
},
{
"cell_type": "markdown",
"id": "90e510c8",
"metadata": {},
"source": [
"```{dropdown} How do I save a plot?\n",
"You can save a plot by directly accessing the returned Matplotlib figure:\n",
"````python\n",
"sc.pl.umap(adata, color=[\"leiden\"], show).figure.savefig(\"output_path.ext\")\n",
"````\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "7d7410a1-333a-4f21-b53e-91af768b07c7",
Expand Down
5 changes: 1 addition & 4 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
copyright = f"{datetime.now():%Y}, {author}"
release = version = meta["Version"]

extensions = [
"myst_nb",
"sphinx.ext.intersphinx",
]
extensions = ["myst_nb", "sphinx.ext.intersphinx", "sphinx_design"]
myst_enable_extensions = [
"colon_fence",
]
Expand Down
3 changes: 1 addition & 2 deletions paga-paul15.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -913,7 +913,6 @@
" fontsize=12,\n",
" frameon=False,\n",
" edges=True,\n",
" save=True,\n",
")"
]
},
Expand Down
6 changes: 2 additions & 4 deletions pbmc3k.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -1690,9 +1690,7 @@
}
],
"source": [
"sc.pl.umap(\n",
" adata, color=\"leiden\", legend_loc=\"on data\", title=\"\", frameon=False, save=\".pdf\"\n",
")"
"sc.pl.umap(adata, color=\"leiden\", legend_loc=\"on data\", title=\"\", frameon=False)"
]
},
{
Expand Down
643 changes: 523 additions & 120 deletions plotting/core.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies = [
"sphinx",
"myst-nb",
"scanpydoc[theme]>=0.13.4",
"sphinx_design"
]

[tool.hatch.version]
Expand Down