aristoteleo / spateo-viewer

Web application demonstrating 3D modeling of spatial transcriptomics
BSD 2-Clause "Simplified" License
11 stars 3 forks source link

Custom color palette for spateo viewer #3

Closed Harrison-Q-Ma closed 11 months ago

Harrison-Q-Ma commented 1 year ago

Dear spateo viewer team,

Thanks for creating such an awesome tool! I recently ran into an issue when trying to visualize an aligned object created with spateo. The object displayed correctly but I cannot figure out how to use custom color palette for different categorical variables. I can only choose from the color maps included in spateo viewer. Is custom color palette currently supported in spateo viewer? Thank you very much!

Yao-14 commented 1 year ago

Hi, @Harrison-Q-Ma.Thank you very much for using spateo-viewer. Your idea is very good, and we have found a great solution to this problem and will update it later.

Yao-14 commented 11 months ago

Hi @Harrison-Q-Ma , currently static-viewer provides a way to customize the colormap, I think it should be helpful to you.

How to upload custom colors

The colors to be uploaded should be saved in the uploaded anndata object, which should be stored in anndata.uns in the form of a list. Examples are as follows:

Uploaded colors list (the key of colors ends with "colors"):

   adata.uns["anno_tissue_list_colors"] = ["#ef9b20", "#f46a9b", "#ece05a", "#ede15b", "#ea5545", "#9a82e0", "#87bc45", "#ec5646", "#bdcf32"]