gnuplot documentation
gnuplot documentation
gnuplot documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
70 SET-SHOW <strong>gnuplot</strong> 4.3 125<br />
70.50.3 Functions<br />
Use set palette functions , , to define three formulae for the R(gray),<br />
G(gray) and B(gray) mapping. The three formulae may depend on the variable gray which will take<br />
values in [0,1] and should also produce values in [0,1]. Please note that might be a formula<br />
for the H-value if HSV color space has been chosen (same for all other formulae and color spaces).<br />
Examples:<br />
To produce a full color palette use:<br />
set palette model HSV functions gray, 1, 1<br />
A nice black to gold palette:<br />
set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8<br />
A gamma-corrected black and white palette<br />
gamma = 2.2<br />
color(gray) = gray**(1./gamma)<br />
set palette model RGB functions color(gray), color(gray), color(gray)<br />
70.50.4 File<br />
set palette file is basically a set palette defined () where is read from a<br />
datafile. Either 4 columns (gray,R,G,B) or just three columns (R,G,B) have to be selected via the using<br />
data file modifier. In the three column case, the line number will be used as gray. The gray range is<br />
automatically rescaled to [0,1]. The file is read as a normal data file, so all datafile modifiers can be<br />
used. Please note, that R might actually be e.g. H if HSV color space is selected.<br />
As usual may be ’-’ which means that the data follow the command inline and are terminated<br />
by a single e on a line of its own.<br />
Use show palette gradient to display the gradient.<br />
Examples:<br />
Read in a palette of RGB triples each in range [0,255]:<br />
set palette file ’some-palette’ using ($1/255):($2/255):($3/255)<br />
Equidistant rainbow (blue-green-yellow-red) palette:<br />
set palette model RGB file "-"<br />
0 0 1<br />
0 1 0<br />
1 1 0<br />
1 0 0<br />
e<br />
Binary palette files are supported as well, see binary general (p. 66). Example: put 64 triplets of<br />
R,G,B doubles into file palette.bin and load it by<br />
set palette file "palette.bin" binary record=64 using 1:2:3<br />
70.50.5 Gamma correction<br />
For gray mappings gamma correction can be turned on by set palette gamma . <br />
defaults to 1.5 which is quite suitable for most terminals.<br />
For color mappings no automatic gamma correction is done by <strong>gnuplot</strong>. However, you may easily<br />
implement gamma correction. Here is an example for a gray scale image by use of explicit functions for<br />
the red, green and blue component with slightly different values of gamma<br />
Example: