Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose a better color scheme #355

Closed
rafaqz opened this issue Dec 26, 2022 · 16 comments
Closed

Choose a better color scheme #355

rafaqz opened this issue Dec 26, 2022 · 16 comments

Comments

@rafaqz
Copy link
Owner

rafaqz commented Dec 26, 2022

Currently we're using :curl which looks great but is incorrect usage of a diverging scheme and really doesn't work for Bool maps:

im

Personally I use :batlow the most these days:
trim_example_after

But I would really like some suggestions from people who know colors better than I do.

Preferably something from ColorSchemes.jl but I'm open to other suggestions too.

@mkborregaard and @cormullion as the most knowledgeable people I know on the subject, do you have any suggestions here? Should it just be :viridis ? it seems a bit boring and doesn't have a wide enough color range. There is also :terrain ?

@rafaqz rafaqz changed the title Choose a better colorscheme Choose a better color scheme Dec 26, 2022
@rafaqz
Copy link
Owner Author

rafaqz commented Dec 26, 2022

:viridis
viridis
:terrain
terrain

@evetion
Copy link

evetion commented Dec 26, 2022

Well, any cmocean or scientific colormap is ok here. Terrain isn't perceptually uniform. Viridis and plasma from mpl are, viridis being the default there.

Personally I like colorschemes with many colors to distinguish patterns in my data, such as turbo, even though it isn't perfectly uniform.

So viridis and delta? And ofcourse, there are cases, but harder to detect, where you want other colors, such as boolean, but also discrete and circular.

@cormullion
Copy link

Not sure, really. Doesn't it depend on what you're trying to plot or to highlight? More color variation (ie terrain rather than viridis) might be better for detailed images.

@rafaqz
Copy link
Owner Author

rafaqz commented Dec 26, 2022

@cormullion I was guessing that people will choose something when they really know what they want, this is just for the default exploratory plot(myraster) output, like the most generic scheme for all kinds of raster data that will be ok for everything.

It seems we agree on the issue - perceptual maps are accepted as the best, but in practice we often prefer more color range than perfect perceptual uniformity.

:delta is great but it has the problem that high and low values look nearly the same, so boolean mask or a few categorical values don't really show up well.

@briochemc
Copy link

My 2 cents: What about Plots.jl's default? (I think it's one of inferno or magma, which were made together with viridis and plasma IIRC). Otherwise, there is the similarly good cividis.

And if you are going to dispatch to a different colormap for boolean args I think the first 2 colors of a categorical palette is better, e.g., tableau_10 or tol_light for example.

@rafaqz
Copy link
Owner Author

rafaqz commented Dec 29, 2022

Your right probably just using a different palette for Bool is a good idea.

My hesitation to use inferno/magma/viridis/cividis is the short color range they cover often makes it hard to see the detail in a map - as @evetion mentioned often you need something like turbo.

I guess I'm wondering if we can make a compromise between perceptual consistency and detail. The R raster default has a really wide range:

hist-raster-1

I dont love that colorscheme but you can see a lot of detail.

@rafaqz
Copy link
Owner Author

rafaqz commented Dec 29, 2022

To run with the maximising detail idea I'm playing with a widened batlow like this custom 1.5 cycle hue with lumin/chroma gradient. I think it does better than turbo for detail, and far more than viridis above. Without the perceptual evenness problems of terrain. But still needs some tweaking (made with http:https://hclwizard.org:3000/hclwizard/)

My custom monstrosity:
detail

:turbo:
turbo

Maybe just getting :batlowW in ColorSchemes.jl would be better.

@mkborregaard
Copy link
Contributor

mkborregaard commented Jan 2, 2023

I'd definitely recommend using a well-vetted perceptually uniform color scheme. These ones are really good. https://juliagraphics.github.io/ColorSchemes.jl/stable/catalogue/#cmocean

But for the record I disagree with the notion that having a wider range of colors improves the ability to discern detail, though it's a common misperception. The human eye is quite capable of distinguishing even small changes in luminosity. Having a wide range of colors have the single advantage of making it easier to compare colors very exactly at different regions of the map, but at the cost of losing the ability to perceive gradual gradients. I don't think that's a very good tradeoff to make.

I'd warmly recommend reading all 6 chapters of this essay: https://earthobservatory.nasa.gov/blogs/elegantfigures/2013/08/05/subtleties-of-color-part-1-of-6/

(small correspondence here https://www.nature.com/articles/519291d - the custom "batlow" color scheme above suffers from the very same issues in my opinion)

@rafaqz
Copy link
Owner Author

rafaqz commented Jan 2, 2023

Thanks! That's super useful input.

Overall I do agree on using something tested, although you would be surprised how easy it is to make perceptually even colorschemes these days. And even new R packages like terra still use these non-perceptual colorschemes with wide color ranges, there has to be a reason for that.

Do you think anything in cmocean is better than :batlow ? Overall they look good, but there is no one default that stands out to me. :delta is great, except the white band in the middle is the same problem we have currently. So I guess :deep, :haline and :thermal are the contenders?

The main problem I find with seeing detail in shorter scientific color ranges like viridis/magma etc is in the dark ends of the range - this is pretty well demonstrated in viridis above - in the "contrast" layer you can barely see detail in the north of Australia that you can quite easily see with :terrain.

@mkborregaard
Copy link
Contributor

I don't have much against :batlow, it's not the prettiest, but appears appropriate and it does address some of the issues you have. Personally I have a preference for more subtle color schemes, as I find the over-saturated color schemes tend to be even harder to distinguish details with.

Plots' default is :magma, introduced by the matplotlib fans. I find that and :viridis a little overhyped, they are fine but as you say many are just as good.

With regards to the dark color under contrast I'd argue that distinguishing too much detail there is almost a bug, given that the variation is really slight compared to the overall variation in the image. That's another issue with the many-color scales, that it tends to over-emphasize even small variations.

My personal take: turbo (the old matlab default) and terrain (the R default) are in my opinion some of the worst schemes out there, if you'll allow me to be blunt.

So maybe batlow or something like :tempo?

@rafaqz
Copy link
Owner Author

rafaqz commented Jan 3, 2023

This is exactly the blunt, opinionated feedback I was looking for ;)

My reasoning for batlow over the others is from this paper:
https://www.nature.com/articles/s41467-020-19160-7
https://www.fabiocrameri.ch/batlow/

But I will also check out :tempo

@briochemc
Copy link

turbo (the old matlab default)

Not that this is important, but no, turbo is not MATLAB's old default. You're thinking about jet, right? turbo is much better than jet IMO.

@briochemc
Copy link

Colorcet ones are good too, and their website does a good job with their gallery that showcases the perceptual gradients with a test image that has a little sinewave

Screen Shot 2023-01-04 at 8 05 15 am

where wiggles appear clearly and reach further downwards if the gradient is perceptually strong, and wiggles disappear if the gradient is weak.

There's a nice comparison with jet as well:
Screen Shot 2023-01-04 at 8 08 57 am

(The names of the colormaps seem different from ColorSchemes.jl so maybe worth an issue?)

@rafaqz
Copy link
Owner Author

rafaqz commented Jan 3, 2023

Yeah turbo is much better than jet https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html

@briochemc is there any one scheme from colorcet that you really like for maps though? The geographical one is for hillshade.

@briochemc
Copy link

I'm not sure which is best... But maybe worth pinging @peterkovesi himself?

I just realized he ported his work to Julia! (See PerceptualColourMaps.jl.)

@mkborregaard
Copy link
Contributor

All the colorcet maps are also included in Colorschemes.jl now. It makes sense to use that package imho.
Yeah I'm thinking about jet (which is copyrighted by matlab, and which they left behind to instead use parula), but in my view turbo is close enough a copy to essentially be the same. It's possibly slightly better but definitely not much better imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants