Hi, Xin-
AFNI recognizes those specially named colors, and in many cases hex-defined values (like "#000000", etc.) and even the fancy matplotlib-color names ("dodgerblue", etc. here).
At present, I don't think you can create an arbitrarily colorized discrete colorbar there. But, you can create your own colorbar, and you can make it in a couple different ways so it could be either discrete or smooth. In your case, if you want 7 color blocks with some non-available colors, you could make a 256-valued colorbar with colors defined in chunks, and load either load it in through the GUI (button clicking) or via the AFNI_COLORSCALE_xx
environment variable, which is described here. Personally, the latter seems nicer to me. NB: the description of ways to add your own colorbars has some helpful suggestions for continuous ones, as well.
So, if you wanted a discrete colorbar of 7 colors, you could make it in the following kind of file:
- top line: A name for the colorbar (no spaces)
- 256 lines of the hex values you want
Discrete-cbar-A
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffff00
#ffaa00
#ff0000
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
... and here's another one, using some matplotlib colorbar names:
Discrete-cbar-B
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
dodgerblue
#ffaa00
#ff0000
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#aa00aa
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#ff0000
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#0000ff
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#6a5acd
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#ff6347
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
#3cb371
Then, open up your ~/.afnirc
file for setting environment variables, and add pointers to each of those files using the full path, which on my system meant I put (starting enumeration at "04" because I had some previously existing colorbars):
AFNI_COLORSCALE_04 = /home/ptaylor/AFNI_data6/FT_analysis/FT/cbar4.txt
AFNI_COLORSCALE_05 = /home/ptaylor/AFNI_data6/FT_analysis/FT/cbar5.txt
Then, when I open up AFNI, and have an overlay, I can right click on the colorbar and select one of my fancy new colorbars, finding the name of each I had put in the top line. Those look like this here:
(I see now that I clicked "Pos?" on one of those images, so the ranges of values are different, but the colorbars work the same.)
So, the math part of this would be calculating what fraction of 256 lines of colors you want to be a given color. The ranges can be whatever you want. Frankly, though, I would find this easier than moving the little ranges around in the discrete-bar definer.
How does that seem?
--pt