June 5th, 2013 | 7 Comments
If you are looking for nice color maps which are especially prepared to work with cartographic like plots you should have a look at colorbrewer2.org. On that site hosted by Cynthia Brewer you can pick from a large set of well balanced color maps. The maps are ordered regarding their usage. Figure 1 shows example color maps for three different use cases.
The diverging color maps are for data with extremes at both points of a neutral value, for example like the below and above sea level. The sequential color maps are for data ordered from one point to another and the qualitative color maps are for categorically-grouped data with now explicit ordering.
Thanks to Anna Schneider there is an easy way to include them (at least the ones with eight colors each) into gnuplot. Just go to her gnuplot-colorbrewer github site and download the color maps. Place them in the same path as your plotting file, or add the three pathes of the repository to your load pathes, for example by adding the following to your .gnuplot file.
set loadpath '~/git/gnuplot-colorbrewer/diverging' \ '~/git/gnuplot-colorbrewer/qualitative' \ '~/git/gnuplot-colorbrewer/sequential'
After this you can pick the right color map for you on colorbrewer2.org, keep its name and load it before your plot command. For example in Fig. 2 we are plotting again the photoluminescence yield with the sequential color map named YlGnBu
. First we load the color map, then switch the two poles of the color map by setting the palette to negative
, and finally plotting the data.
load 'YlGnBu.plt' set palette negative plot 'matlab_colormap.txt' u ($1/3.0):($2/3.0):($3/1000.0) matrix with image
The nice thing of the palettes coming with gnuplot-colorbrewer is that they also include the corresponding line colors. In Fig. 3 you see the Paired
qualitative color map in action with lines.
load 'Paired.plt' plot for [ii=1:8] f(x,ii) ls ii lw 2