maximilianh / cellBrowser

main repo: https://github.com/ucscGenomeBrowser/cellBrowser/ - Python pipeline and Javascript scatter plot library for single-cell datasets, http://cellbrowser.rtfd.org
https://github.com/ucscGenomeBrowser/cellBrowser/
GNU General Public License v3.0
104 stars 40 forks source link

Color legend doesn't behave well with negative numbers #131

Closed matthewspeir closed 2 years ago

matthewspeir commented 5 years ago

Hey, Max.

So, it looks like something weird is going on with color by gene expression when the gene expression includes negative values. Basically the zero gets put below the negative numbers and assigned a lighter color than the negative numbers. The zero should be in between the negative and positive numbers: cellbrowser_weirdLegend

This is for the organoidatlas dataset available on cells-test. I guess we can also ask them why the have negative expression values as well.

Additionally, it seems like for a metadata field with diverging numbers, we should use a diverging color palette? So, something where the light, almost white color is in the middle and the two colors diverge from that. Something like the 'Qualitative: Paul Tol' palette we already have.

maximilianh commented 4 years ago

Oh. Nice. The problem here is slightly different, I had not thought about expression scales where the 0 is not a special value. Usually, for TPMs and counts, 0 is a special case, so it's pulled out and put first.

I should handle this better, but in the meantime, I'll ask Yoshi what these numbers are, we should document this anyways in the dataset descriptor.

On Fri, Aug 30, 2019 at 11:36 PM Matt Speir notifications@github.com wrote:

Hey, Max.

So, it looks like something weird is going on with color by gene expression when the gene expression includes negative values. Basically the zero gets put below the negative numbers and assigned a lighter color than the negative numbers. The zero should be in between the negative and positive numbers: [image: cellbrowser_weirdLegend] https://user-images.githubusercontent.com/11509990/64040629-522c5e00-cb12-11e9-887a-7b2126cee9da.png

This is for the organoidatlas dataset available on cells-test. I guess we can also ask them why the have negative expression values as well.

Additionally, it seems like for a metadata field with diverging numbers, we should use a diverging color palette? So, something where the light, almost white color is in the middle and the two colors diverge from that. Something like the 'Qualitative: Paul Tol' palette we already have.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maximilianh/cellBrowser/issues/131?email_source=notifications&email_token=AACL4TIBD2AOXK3A2PYA4GLQHGHGHA5CNFSM4ISRK4DKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIRMY4Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AACL4TIQVSOBXJOGJ3BLXYDQHGHGHANCNFSM4ISRK4DA .

maximilianh commented 4 years ago

I've added some minimal detection code for now but this doesn't solve the problem yet.

On Tue, Sep 10, 2019 at 3:08 PM Maximilian Haeussler maximilianh@gmail.com wrote:

Oh. Nice. The problem here is slightly different, I had not thought about expression scales where the 0 is not a special value. Usually, for TPMs and counts, 0 is a special case, so it's pulled out and put first.

I should handle this better, but in the meantime, I'll ask Yoshi what these numbers are, we should document this anyways in the dataset descriptor.

On Fri, Aug 30, 2019 at 11:36 PM Matt Speir notifications@github.com wrote:

Hey, Max.

So, it looks like something weird is going on with color by gene expression when the gene expression includes negative values. Basically the zero gets put below the negative numbers and assigned a lighter color than the negative numbers. The zero should be in between the negative and positive numbers: [image: cellbrowser_weirdLegend] https://user-images.githubusercontent.com/11509990/64040629-522c5e00-cb12-11e9-887a-7b2126cee9da.png

This is for the organoidatlas dataset available on cells-test. I guess we can also ask them why the have negative expression values as well.

Additionally, it seems like for a metadata field with diverging numbers, we should use a diverging color palette? So, something where the light, almost white color is in the middle and the two colors diverge from that. Something like the 'Qualitative: Paul Tol' palette we already have.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/maximilianh/cellBrowser/issues/131?email_source=notifications&email_token=AACL4TIBD2AOXK3A2PYA4GLQHGHGHA5CNFSM4ISRK4DKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIRMY4Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AACL4TIQVSOBXJOGJ3BLXYDQHGHGHANCNFSM4ISRK4DA .

matthewspeir commented 4 years ago

@maximilianh What else were you imagining for this ticket?

maximilianh commented 4 years ago

I think what I fixed is that the 0 is not first anymore but in order. What I didn't change was the color scale.

With expression values, I think having the white on the negative numbers, as we have it now, makes most sense. It's just a gradient from low to high after all.

With meta data I'm not sure... do you have an example with negative numbers in the meta data?