If you are a regular gnuplot user you most probably want to reuse some common settings. I normally avoid it on this blog to have easy scripts that run as standalone files, but during my work I use a lot of small config files.

Let us start with the Bessel function example from the last blog entry. As you can see in Fig. 1, it is a 2D plot, including axes, a grid, line colors, and definitions of higher order Bessel functions. All of those could be easily stored in small config files and reused in other plots.
As an example I will start with the axes. Here, I have four different config files, called xyborder.cfg, xborder, yborder.cfg, noborder.cfg, which do exactly what their names would suggest. Here are the first and last file:

In the main plotting file I then just have to load the setting I like to have and I’m done. The same can be done for adding a grid, the right line color definitions and the extra Bessel functions leading to the following excerpt from the main plotting file:

If you want to include more complicated settings, you have to use the macro setting of gnuplot. Fig. 2 is a reproduction of an earlier entry plotting a vector field with arrows. It included an lenghty definition of how to plot these arrows. If you want to do it several time and define the arrows in the same way every time you should also put it into a config file, this time as a variable (macro). In our example it looks like

As you may have noted, gnuplot and Matlab have different default color maps. Designing such a default map is not easy, because they should handle a lot of different things (Moreland, 2009):
– The map yields images that are aesthetically pleasing
– The map has a maximal perceptual resolution
– Interference with the shading of 3D surfaces is minimal
– The map is not sensitive to vision deficiencies
– The order of the colors should be intuitively the same for all people
– The perceptual interpolation matches the underlying scalars of the map

In his paper Moreland developed a new default color map that was mentioned already in a user comment. In Fig. 1 the map is used to replot the photoluminescence yield plotted in an earlier entry.

To use the default color map proposed by Moreland, just download default.plt and store it to a path, that is available to gnuplot. For example store it under /home/username/.gnuplotting/default.plt and add the following line to your .gnuplot file.

Often we use a specific line color or output terminal in Gnuplot. Or we are not satisfied with one of the default settings, for example the font used by the png terminal. There exists an easy way to fix these settings. Gnuplot reads a startup file, called .gnuplot under Linux and GNUPLOT.INI under Windows. First it searches the current directory and then your home directory after that file.

Here is an example of what is possible to include in the startup file.