Palantir icon indicating copy to clipboard operation
Palantir copied to clipboard

How do you go about repositioning this arrow so that it starts and ends in the right place?

Open ltzyl opened this issue 4 months ago • 1 comments

Image

this is my code: palantir.plot.plot_trajectories(subadata, pseudotime_interval=(.1, .9))

I found that no matter how I adjusted it I couldn't get the arrow in the correct position for the end cell. If you turn up the end in pseudotime_interval(,end), you get arrows ending beyond the umap plot, and if you turn it down, you get arrows ending in the center of the plot.

And there is also a problem that even though I set the terminal states, he will find another end point and I don't know how to adjust this.

Image Image

this is my code: dm_res = palantir.utils.run_diffusion_maps(abT,pca_key='X_pca_harmony', n_components=20) ms_data = palantir.utils.determine_multiscale_space(dm_res,n_eigs=13) pr_res = palantir.core.run_palantir(ms_data, 'R3.61,R2.16,R1.47,P1.02', num_waypoints=1500,knn=40, terminal_states=terminal_states)

ltzyl avatar Aug 18 '25 03:08 ltzyl

Hi @ltzyl,

Thanks for reporting this, and apologies, the plot definitely doesn’t look right. The arrows are computed and smoothed based on the positions of cells in the embedding_basis (default: "X_umap") and the branch selection that assigns cells to branches. That means there are two possible sources of error here:

1. Incorrect branch cell selection

If the wrong cells are being used per branch, the curves will look off. You can check this by plotting:

palantir.plot.plot_branch_selection(ad)

If the branch assignment looks wrong, try rerunning:

palantir.presults.select_branch_cells(ad, q=.01, eps=.01)

with adjusted q and eps tolerances (see the tutorial for guidance).

2. Over-smoothing of trajectories

If your embedding has a very different scale, the default parameters may oversmooth the curves. Based on your plot, this seems likely. You can reduce smoothing by setting the smoothness parameter to a value below 1 in plot_trajectories (see the manual).

Please let me know if the issue persists, or if you run into other questions. Good luck!

katosh avatar Aug 21 '25 21:08 katosh