kharchenkolab / Baysor

Bayesian Segmentation of Spatial Transcriptomics Data
https://kharchenkolab.github.io/Baysor/
MIT License
155 stars 31 forks source link

How to change color in plot_molecules #44

Closed zhanglab2008 closed 1 year ago

zhanglab2008 commented 2 years ago

Dear @VPetukhov , If I don't like the default color in the :ncv_color column of the df_spatial DataFrame, how can I change it to a customized color palette? I really like to use Baysor but my Julia skill is at baby stage so far. Thanks in advance! Zhang

VPetukhov commented 1 year ago

Dear @zhanglab2008 , Sorry for the late response. What do you mean by color palette? If it's about the whole coloring scheme during NCV estimation, it can't be changed. The colors are optimized in a way that similarity between gene composition matches perceptive similarity of these colors. In the current method, there is no way to do it only within a given color palette.

If you want to play with it, it should be somewhere during conversion of 3D space to a CIELAB color palette (normalize_embedding_to_lab_range). For example, there is a parameter lrange that allows you to specify how close to white/black the colors can get. Similar can be done with other dimensions. But it's not like restricting to a given nice color palette. If anyone have ideas on how to implement that, I'd be happy to add it to the package.