Colorscale gap width?

Dear AFNI Team,

I hope you are doing well. I was wondering whether the colorscale gap width is something that can be modified? For example, I have some sort of anatomical underlay and a t-statistics overlay. I choose a colorscale like “Spectrum:red_to_blue+gap”. This gives a nice colormap where negative t-stats are shown in blue and positives are in red. At the same time, it nulls out any t-statistic values around 0 from the display, from approximately -0.25 to +0.25 (based on a visual ballpark). However, is it possible to increase the width of this gap?

I know I can suppress overlay voxels below a t-stat (or p-value) cutoff by changing the threshold. Ultimately I will do that, but I also take advantage of the full color variation. For example, if I’m looking at t-stats >3, there’s a lot of colorscale variation given to [+0.25, +3] that is “wasted”, since I cut that range off. So, the final overlay voxels that DO get displayed only live in a narrow band of color variation of “really red” to “even more red”, as opposed to “yellow” to “red”. It would be nice to have “yellow” start at +3 and “red” end with +5 or something like that, which is what I think controlling the gap would help with.

If relevant, I am using version AFNI_19.2.24.

Thank you!


Hi, Conan-

To my knowledge, there isn’t (but I could be corrected by someone else here, perhaps).

A slightly different point is that: many papers show using statistic values overlays, as well as using them to threshold. That ignores the very important information stored in the effect estimates. And we would suggest that in most cases, there are better ways to present the “fuller” modeling results, including both the effect estimate and statistical info. This is discussed persuasively by Gang here:
Chen G, Taylor PA, Cox RW (2017). Is the statistic value all we should care about in neuroimaging? Neuroimage. 147:952-959. doi:10.1016/j.neuroimage.2016.09.066
… and using the GUI to show this fuller information is described here:

Additionally, we’ve also started to recommend that people show a lot more of the data, in particular putting less emphasis on thresholds—or at least, showing modeling results even in “sub-threshold” regions, so readers can evaluate the full output of the modeling. This is accomplished in the GUI using “translucent” thresholding with the “alpha” and “boxed” buttons, which are described toward the end of the above Bootcamp video (starting around 17:20 or so; but it would be worth watching the whole video for the other results display purposes, described above).


Adding on to Paul’s sage advice, here are a few more GUI tips.

  1. AFNI_PBAR_THREE. Set this environment variable that has three panes that you can drag up and down. It’s useful for windowing the overlay in a more flexible way. The middle bar is the main colorbar, but you can set above and below to solid colors.
  2. Paned color scales. Below the colorbar, you can select what’s usually a “**” for a continuous color scale and choose a specific number of panes, up to 20. Each of the panes can be dragged by the bars at the edge of each color. You can also select the color by clicking on it.
  3. Make a new color map. At the top of the colorbar, you can choose to save the palette. That will be a text file you can edit that has RGB encoded in hexadecimal by every two characters. Change the number of lines that contain “#000000” to control how big the gap is. Change the name of the palette in the file so that it will show up in the color scale list with a new name too. The file looks like this:

cat testpal.pal 

Load the modified palette file with the “Read in palette” function with the right click at the Olay text. Select the palette to load it into the colorbar selections. Right click on the colorbar to “Choose colorscale” and choose the new colorscale.

Hi PT,

Thanks for such a quick reply, and the broader discussion of how best to display data. I’ve been playing with the “alpha” and “boxed” videos but only learned that through word of mouth. I plan to take a more thorough look at the bootcamp video you linked - very helpful.


Hi Daniel,

Thanks so much for these details. Seems like I may need to play around with things more. Really appreciate the help! And I will follow-up if I have more questions.