Tangram icon indicating copy to clipboard operation
Tangram copied to clipboard

the coordinates are flipped

Open Lena926 opened this issue 3 years ago • 2 comments

Hello, thank you for creating such a useful tool, I am very happy to use it in my data, but when I draw a graph with tg.plot_cell_annotation_sc, I find that the coordinates are flipped, how can I solve it?

when I use scanpy I got this: image

But tg.plot_cell_annotation_sc image

Thanks a lot!

Lena926 avatar Aug 07 '22 14:08 Lena926

Hi @Lena926 ,

the reason for the inconsistency is that in scanpy (or squidpy ) we enforce the origin (0, 0) to be on the top left, as is common convention with image data. You can recover this by flipping the coords in adata.obsm["spatial"] with np.flipud and np.fliplr

giovp avatar Aug 08 '22 09:08 giovp

Hi @Lena926 ,

the reason for the inconsistency is that in scanpy (or squidpy ) we enforce the origin (0, 0) to be on the top left, as is common convention with image data. You can recover this by flipping the coords in adata.obsm["spatial"] with np.flipud and np.fliplr

Thanks for your help, I'll give it a try

Lena926 avatar Aug 08 '22 10:08 Lena926