Skip to content

[OWKINxSCVERSE hack]: anndata-plot MVP #3517

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ dependencies = [
"tqdm",
"scikit-learn>=1.1,<1.6",
"statsmodels>=0.13",
"patsy!=1.0.0", # https://github.com/pydata/patsy/issues/215
"patsy!=1.0.0", # https://github.com/pydata/patsy/issues/215
"networkx>=2.8",
"natsort",
"joblib",
Expand All @@ -65,8 +65,9 @@ dependencies = [
"pynndescent>=0.5",
"packaging>=21.3",
"session-info2",
"legacy-api-wrap>=1.4", # for positional API deprecations
"legacy-api-wrap>=1.4", # for positional API deprecations
"typing-extensions; python_version < '3.13'",
"anndata-plot @ git+https://github.com/scverse/anndata-plot.git",
]
dynamic = [ "version" ]

Expand Down Expand Up @@ -139,6 +140,8 @@ dev = [
"pre-commit", # static checking
"towncrier", # release note management
]


# Algorithms
paga = [ "igraph" ]
louvain = [ "igraph", "louvain>=0.6.0,!=0.6.2" ] # Louvain community detection
Expand All @@ -160,6 +163,8 @@ packages = [ "src/testing", "src/scanpy" ]
source = "vcs"
raw-options.version_scheme = "release-branch-semver"

[tool.hatch.metadata]
allow-direct-references = true
[tool.pytest.ini_options]
addopts = [
"--import-mode=importlib",
Expand Down
22 changes: 22 additions & 0 deletions src/scanpy/plotting/_stacked_violin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
import warnings
from typing import TYPE_CHECKING

import anndata_plot as adp
import holoviews as hv

_ = adp # so linters don't complain
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from matplotlib.colors import is_color_like
from packaging.version import Version

import scanpy as sc

from .. import logging as logg
from .._compat import old_positionals
from .._settings import settings
Expand All @@ -23,6 +29,9 @@
savefig_or_show,
)

hv.extension("bokeh")


if TYPE_CHECKING:
from collections.abc import Mapping, Sequence
from typing import Literal, Self
Expand Down Expand Up @@ -847,6 +856,19 @@ def stacked_violin(
yticklabels=yticklabels,
linewidth=kwds.get("linewidth", _empty),
).legend(title=colorbar_title)

hv.extension("matplotlib")

adata = sc.datasets.pbmc3k()
sc.pp.neighbors(adata)
sc.tl.umap(adata)
sc.tl.leiden(adata)
print(adata)

return hv.Scatter(adata, "obsm.X_umap.0", ["obsm.X_umap.1", "obs.leiden"]).opts(
color="obs.leiden", cmap="Category20"
)

if return_fig:
return vp
vp.make_figure()
Expand Down
Loading