Color palette vik- set white color at zero

Dear all,

I am creating a map and I am using the color palette vik. It is working (with the color bar plotted) with the following commands:
gmt makecpt -T-6/9/5 -Cvik -Z
gmt psscale -D0/-0.8+w15/0.5+h -C -Ba4

Now, I would like to set the range of the bar in a way that is symmetric about zero, with hinge at the white color. I tried few options, including +h0, which I thought was supposed to give me what I wanted but is not working.
Maybe someone has suggestions? That would be greatly aprreciated.

Chiara

Forgot to say I am using 6.1 version

Caveat: I think there have been some bug fixes that may impact your color palette and colorbar in more recent versions of 6.x. I’m testing with 6.5.0, so there may be some differences beyond gmt colorbar instead of gmt psscale.

For a white hinge, try using a smaller series increment with “+h” to activate the hinge at 0: gmt makecpt -T-6/9/1 -Cvik+h0 -Z (#2) or omit the increment and -Z (#3). I think your large increment of 5 causes the interpolation to miss the white.

If, by symmetry, you mean you want the white (0-value) to be pinned at 0, I think examples #2 and #3 do this.

Or, do you mean something like “perceptually uniform” (see Scientific colour maps – colour-blind friendly and accurate palettes) where a given “magnitude” of color change represents the same value change across the color scale? For this, see #4 and expand the section below.

TLDR

In the 0-3, the reds are stretched more than the blues. The negative side of your scale is 2/3 the length of the positive side, so the last example, #4, shows the effect of truncating the low end of the master CPT at -0.666667 to achieve perceptual uniformity (so the blue at -6 isn’t as dark as red at +9).

gmt begin demo_cpt_hinge png
  # 0
  gmt makecpt -T-6/9/5 -Cvik -Z
  gmt colorbar -Dx0/-0.8+w15c/0.5c+h -C -Ba1+l"0. -T-6/9/5 (original)"
  # 1
  gmt makecpt -T-6/9/1 -Cvik -Z
  gmt colorbar -Dx0/-0.8+w15c/0.5c+h -C -Ba1+l"1. -T-6/9/1 (whitish hinge not at 0)" -Y-1i
  # 2
  gmt makecpt -T-6/9/1 -Cvik+h0 -Z
  gmt colorbar -Dx0/-0.8+w15c/0.5c+h -C -Ba1+l"2. -T-6/9/1 +h0 (whitish hinge at 0)" -Y-1i
  # 3
  gmt makecpt -T-6/9 -Cvik+h0 #-Z
  gmt colorbar -Dx0/-0.8+w15c/0.5c+h -C -Ba1+l"3. -T-6/9 +h0 (wider/whiter? hinge at 0)" -Y-1i
  # 4
  gmt makecpt -G-0.666667/1 -T-6/9 -Cvik+h0 #-Z
  gmt colorbar -Dx0/-0.8+w15c/0.5c+h -C -Ba1+l"4. -G-0.666667/1  -T-6/9 +h0 (uniform + symmetric)" -Y-1i
gmt end show

1 Like

Dear Jaltekruse,

thank you so much for your detailed explaination.
I think case 4 is more what I was thinking of, but thanks for including the other options. They help me a lot more in understanding how to work with the color palette options.

Chiara

1 Like