How to make amazing UMAP to spatialPlot GIF
1
0
Entering edit mode
1 day ago

Hi everyone,

Any clues how to make this amazing gif which transitions from UMAP to spatial dimplot or similar. Link to the gif is here, otherwise see screenshots below:

https://crukscotlandinstitute.b-cdn.net/images/stories/beatson_research_group/DasGupta/image001.gif

enter image description here

enter image description here

umap spatial • 140 views
ADD COMMENT
1
Entering edit mode
1 day ago
LChart 4.9k

Looks to me to be a sequence of intermediate linear interpolations. For each point you have coordinates (U1, U2) for the UMAP plot, (S1, S2) for the spatial plot. Define:

X_i(t) = t * U_i + (1-t) * S_i

for t = 0, 0.05, 0.1, ..., 0.95, 1.0

Create 21 images.

In python use the pillow library to open the images and create a gif, e.g.

frames = [Image.open(f'imagename_{j}' for j in range(21)]
frames[0].save('output.gif', format='GIF', append_images=frames[1:], save_all=True, duration=30, loop=0)
ADD COMMENT
0
Entering edit mode

Thank you @LChart, wow that sounds like a very elegant solution! I've got the seurat currently in R. I'll export to python and give it a bash.

ADD REPLY

Login before adding your answer.

Traffic: 2277 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6