Skip to content

Commit 3ec5b1b

Browse files
committed
better outline scaling of plot_trajectories
1 parent c64d379 commit 3ec5b1b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/palantir/plot.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,9 @@ def plot_trajectories(
23642364
if arrowprops is None:
23652365
arrowprops = {}
23662366

2367-
arrowprops = {**{"lw": 2, "mutation_scale": 20}, **arrowprops}
2367+
lw = kwargs.get("lw", 1)
2368+
ms = 20 * lw ** .5
2369+
arrowprops = {**{"lw": lw, "mutation_scale": ms}, **arrowprops}
23682370
default_kwargs = {"color": "black"}
23692371
default_kwargs.update(kwargs)
23702372

@@ -2373,9 +2375,10 @@ def plot_trajectories(
23732375
if outline_arrowprops is None:
23742376
outline_arrowprops = {}
23752377

2376-
lw = arrowprops.get("lw", 1) * 2
2378+
lwo = arrowprops.get("lw", 1)
2379+
lwo = lwo + 2 * lwo ** .5
23772380
ms = arrowprops.get("mutation_scale", 20)
2378-
outline_arrowprops = {**{"lw": lw, "color": "black", "mutation_scale": ms}, **arrowprops}
2381+
outline_arrowprops = {**{"lw": lwo, "color": "black", "mutation_scale": ms}, **outline_arrowprops}
23792382

23802383
if scanpy_kwargs is None:
23812384
scanpy_kwargs = {}
@@ -2450,7 +2453,7 @@ def plot_trajectories(
24502453
n=n_arrows,
24512454
ax=ax,
24522455
arrowprops=outline_arrowprops,
2453-
head_offset=.1,
2456+
head_offset=.1*(lwo - lw),
24542457
arrow_zorder=2,
24552458
**branch_kwargs,
24562459
)

0 commit comments

Comments
 (0)