set palette defined (0 1 1 1, 0.17 0 0 1, 0.45 0 0.6 0.6, 0.55 0 1 0.5, 0.8 1 1 0, 0.95 1 0 0, 1 0.4 0 0)

Help: 
With this file you can set the color codes of the X-TEX.
Only the first line of this file matters.
This first line (set palette defined....) works as in gnuplot. 

Helpful templates:

MTEX type colorbar:
set palette defined (0 1 1 1, 0.17 0 0 1, 0.45 0 0.6 0.6, 0.55 0 1 0.5, 0.8 1 1 0, 0.95 1 0 0, 1 0.4 0 0)

white-dark blue-blue-green-yellow-orange-red
set palette defined (0 1 1 1, 0.15 0.05 0.05 0.5, 0.3 0 0 1, 0.45 0 1 0, 0.6 1 1 0, 0.8 1 0.6471 0, 1 1 0 0)

white-blue-dark_green-green-yellow-red
set palette defined (0 1 1 1, 0.2 0 0 1, 0.4 0.1 0.6 0.1, 0.6 0 1 0, 0.8 1 1 0, 1 1 0 0)

red:
set palette defined (0 1 1 1, 1 1 0 0)

green:
set palette defined (0 1 1 1, 1 0 1 0)

blue:
set palette defined (0 1 1 1, 1 0 0 1)