Skip to content

Commit

Permalink
Merge branch 'main' into issue-469
Browse files Browse the repository at this point in the history
  • Loading branch information
grst authored Jan 9, 2024
2 parents 6722d69 + 759bc44 commit 7a2f140
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning][].
Instead it is calculated from the protein sequence and the corresponding start/end coordinates. Note that if you have
a cached `iedb.h5ad` in the `data` folder (relative to your work dir), you need to remove it to re-download the
new version. ([#476](https://github.com/scverse/scirpy/pull/476))
- Fix incompatibility with `adjustText` 1.0 ([#477](https://github.com/scverse/scirpy/pull/477))

## v0.14.0

Expand Down
12 changes: 11 additions & 1 deletion src/scirpy/pl/_clonotype_modularity.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from collections.abc import Sequence
from importlib.metadata import version
from typing import Optional, Union

import numpy as np
from adjustText import adjust_text
from matplotlib import patheffects
from packaging.version import Version

from scirpy.util import DataHandler

Expand Down Expand Up @@ -186,13 +188,21 @@ def clonotype_modularity(
)

if label_adjusttext:
kwargs = {}
# incompatible API between <1.0 and >=1.0. I'd like to pin 1.0, but it's not available from
# conda-forge and there are some issue (https://github.com/Phlya/adjustText/issues/166)
if Version(version("adjustText")) >= Version("1.0"):
kwargs["force_static"] = (0.4, 0.4)
else:
kwargs["force_points"] = (0.4, 0.4)

adjust_text(
label_objs,
score_df["xs"].values,
score_df["ys"].values,
arrowprops={"arrowstyle": "-", "color": "k", "lw": 0.5},
force_text=(0.3, 0.3),
force_points=(0.4, 0.4),
**kwargs,
)

return ax

0 comments on commit 7a2f140

Please sign in to comment.