Gnuplotting

Create scientific plots using gnuplot

June 10th, 2012 | 6 Comments

In one off the last entries we defined a color palette similar to the default one in Matlab. Now we will use a color palette with only a few discrete colors, as shown in Fig. 1. This can be useful if we want to see all values from a measurement lying above a given threshold.

Palette with discrete colors

Fig. 1 Photoluminescence yield plotted with a palette with discrete colors (code to produce this figure, data)

The trick is to set maxcolors to the number of colors you want in your plot. In addition, the colors to use can be specified by the defined command. Note, that the absolute values you specify in the palette definition were automatically scaled to your min and max values (0 and 18 in this case).

set palette maxcolors 3
set palette defined ( 0 '#000fff',\
                      1 '#90ff70',\
                      2 '#ee0000')