dankelley / oce

R package for oceanographic processing
http://dankelley.github.io/oce/
GNU General Public License v3.0
143 stars 42 forks source link

Q: should oce support "turbo" colour palette? #1698

Closed dankelley closed 4 years ago

dankelley commented 4 years ago

I propose to add the 'turbo' colour scheme to oce, and am writing this to ask oce co-developers @richardsc and @clayton33 if they agree that this is acceptable. Obviously, I can use it in my own work without altering oce, but my guess is that some oce users who like "jet" might want to switch to this "turbo" variant.

Sometimes, the "jet" colour scheme can be useful, when the task is to "read off" values by matching to a colour palette, as opposed to the task of seeing trends. However, "jet" has an annoying habit of drawing the eye to particular colours. This is because the mapping from perceived lightness and "z" value is not smooth in the jet scheme (as is pointed out in many citations, of which [1] is a good paper to start with).

In reading [2] today, I learned about the "turbo" colour scheme [3]. The latter has a smoother "brightness" diagram (probably the wrong word but see [3] for graphs), so e.g. yellow does not pop out as being distinct. Since "turbo" is released in an Apache license, the numbers can be incorporated into oce without legal problems [4]. The data file I use in the R script is at [5].

As a test, the following test code makes as shown in the graph below the references. Note that the 'turbo' scheme retains the general rainbow character of 'jet', but without drawing the eye to yellow and similar spots where lightness shifts draw the eye.

library(oce)
library(cmocean)
rgb <- read.csv("turbo.txt", header=TRUE) # see [5]
col <- rgb(rgb$R, rgb$G, rgb$B, maxColorValue=1)
data(levitus, package="ocedata")
SST <- levitus$SST
par(mfrow=c(1, 2))
imagep(SST, col=colorRampPalette(col))
mtext("turbo")
imagep(SST, col=oceColorsJet)
mtext("oceColorsJet")
  1. Kristen Thyng et al., “True Colors of Oceanography: Guidelines for Effective and Accurate Colormap Selection,” Oceanography 29, no. 3 (September 1, 2016): 9–13, https://doi.org/10.5670/oceanog.2016.66.
  2. https://eos.org/features/visualizing-science-how-color-determines-what-we-see?utm_source=eos&utm_medium=email&utm_campaign=EosBuzz052920
  3. https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html
  4. https://en.wikipedia.org/wiki/Apache_License#Compatibility
  5. turbo.txt
Screen Shot 2020-05-29 at 1 48 12 PM
richardsc commented 4 years ago

I say yes! Why not?

j-harbin commented 4 years ago

@dankelley brought this issue to my attention. Although I am not a co-developer of oce, some feed back I can provide is that I like the turbo. Like you said Dan, you could simply use turbo for your own work, but the beauty of "dog fooding" if finding what may be useful for users and incorporating it. I vote to add turbo.

clayton33 commented 4 years ago

May as well !

dankelley commented 4 years ago

Done in "develop" and "master"; now, the code

library(oce)
par(mfrow=c(2, 1))
imagep(volcano,col=oceColorsJet)
imagep(volcano,col=oceColorsTurbo)

gives as below.

I like turbo, because

  1. the eye is not drawn so much to the yellow and that light-blue colour, and
  2. there is less "ledging" (i.e. sudden jumping from one colour grouping to another) overall.

As regards item 2, look at the detail you can see in the lower plot, in the red and blue portions. The other thing -- and this might just be my eyes -- is that there is basically no yellow in the turbo one, which I like because I can never see yellow against white, and also yellow seems to differ from one screen/printer to another.

Honestly, I'm amazed at how much I prefer turbo to jet. I knew I was not in love with jet, but now I'm starting to feel that I'm in hate with it, or at least unlove.

image