theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
412 stars 102 forks source link

Need help with the parsing of stream plot result #1215

Closed NikTuzov closed 6 months ago

NikTuzov commented 6 months ago

Hello:

I'm working with scvelo and my goal is to extract the lines and arrows information displayed by velocity_embedding_stream(). I want to get those coordinates to reuse them elsewhere.

velocity_embedding_stream() is essentially a wrapper for matplotlib.streamplot(). I attached a Jupyter notebook with some data that are fed to matplotlib.streamplot(). The latter generates the lines and arrows as LineCollection and PatchCollection objects, but they end up being on different scales. I tried some hacking to make them agree, all to no avail.

I am sorry for asking a question that is more about matplotlib than scvelo, but matplotlib experts are scarce.

lines_and_arrows.zip

WeilerP commented 6 months ago

You can check the code to generate the figure here and extract the code generating the needed info.