<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>configuration &#8211; Gnuplotting</title>
	<atom:link href="./index.html?simply_static_page=1791" rel="self" type="application/rss+xml" />
	<link>./../../../index.html</link>
	<description>Create scientific plots using gnuplot</description>
	<lastBuildDate>Mon, 02 Jan 2023 18:38:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>
	<item>
		<title>Ease your plotting with config-snippets</title>
		<link>./../../../ease-your-plotting-with-config-snippets/index.html</link>
					<comments>./../../../ease-your-plotting-with-config-snippets/index.html#comments</comments>
		
		<dc:creator><![CDATA[hagen]]></dc:creator>
		<pubDate>Mon, 02 Mar 2015 15:28:51 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arrow]]></category>
		<category><![CDATA[border]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[palette]]></category>
		<category><![CDATA[vectors]]></category>
		<guid isPermaLink="false">./../../../index.html?p=1994</guid>

					<description><![CDATA[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. Fig. 1 Bessel functions from order zero up to six plotted [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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.</p>
<div class="figure">
    <img decoding="async" src="./../../../figs/config-snippets1.png" alt="Bessel functions"/></p>
<p class="caption">
        <strong>Fig. 1 </strong>Bessel functions from order zero up to six plotted with the dark2 line colors. (<a href="./../../../code/config-snippets1.gnu" type="text/plain">code to produce this figure</a>, <a href="./../../../data/dark2.pal">dark2.pal</a>, <a href="./../../../code/xyborder.cfg">xyborder.cfg</a>, <a href="./../../../code/grid.cfg">grid.cfg</a>, <a href="./../../../code/mathematics.cfg">mathematics.cfg</a>)
    </p>
</div>
<p>Let us start with the Bessel function example from the <a href="./../../../matlab-colorbar-parula-with-gnuplot/index.html">last blog entry</a>. 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.<br />
As an example I will start with the axes. Here, I have four different config files, called <code>xyborder.cfg</code>, <code>xborder</code>, <code>yborder.cfg</code>, <code>noborder.cfg</code>, which do exactly what their names would suggest. Here are the first and last file:</p>
<pre class="prettyprint">
# xyborder.cfg
set style line 101 lc rgb '#808080' lt 1 lw 1
set border 3 front ls 101
set tics nomirror out scale 0.75
set format '%g'
</pre>
<pre class="prettyprint">
# noborder.cfg
set border 0
set style line 101 lc rgb '#808080' lt 1 lw 1
unset xlabel
unset ylabel
set format x ''
set format y ''
set tics scale 0
</pre>
<p>In the main plotting file I then just have to load the setting I like to have and I&#8217;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:</p>
<pre class="prettyprint">
# set path of config snippets
set loadpath './config'
# load config snippets
load 'dark2.pal'
load 'xyborder.cfg'
load 'grid.cfg'
load 'mathematics.cfg'
</pre>
<p>The <code>set loadpath</code> command tells gnuplot the directory where it can find all the configuration snippets. If you want to see an overview, look at my <a href="https://github.com/Gnuplotting/gnuplot-configs">gnuplot configuration snippets</a> and at the <a href="https://github.com/Gnuplotting/gnuplot-palettes">collection of palettes and line colors</a>.</p>
<div class="figure">
    <img decoding="async" src="./../../../figs/config-snippets2.png" alt="Vector Field"/></p>
<p class="caption">
        <strong>Fig. 2 </strong> (<a href="./../../../code/config-snippets2.gnu" type="text/plain">code to produce this figure</a>, <a href="./../../../data/moreland.pal">moreland.pal</a>, <a href="./../../../code/noborder.cfg">noborder.cfg</a>, <a href="./../../../code/arrows.cfg">arrows.cfg</a>)
    </p>
</div>
<p>If you want to include more complicated settings, you have to use the <code>macro</code> setting of gnuplot. Fig. 2 is a reproduction of an <a href="./../../../vector-field-from-function/index.html">earlier entry</a> 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</p>
<pre class="prettyprint">
color_arrows = 'u ($1-dx($1,$2)/2.0):($2-dy($1,$2)/2.0):(dx($1,$2)):(dy($1,$2)):\
(v($1,$2)) with vectors head size 0.08,20,60 filled lc palette'
</pre>
<p>In the main file the only thing we have then to do is</p>
<pre class="prettyprint">
set macros
load 'noborder.cfg'
load 'moreland.pal'
load 'arrows.cfg'

# [...] 

plot '++' @color_arrows
</pre>
<p>Important is the first line that enables the use of macros in gnuplot which is disabled by default.</p>
]]></content:encoded>
					
					<wfw:commentRss>./../../../ease-your-plotting-with-config-snippets/feed/index.html</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Default color map</title>
		<link>./../../../default-color-map/index.html</link>
					<comments>./../../../default-color-map/index.html#comments</comments>
		
		<dc:creator><![CDATA[hagen]]></dc:creator>
		<pubDate>Tue, 21 May 2013 13:40:14 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[colormap]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[palette]]></category>
		<guid isPermaLink="false">./../../../index.html?p=1724</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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 (<a href="http://www.sandia.gov/~kmorel/documents/ColorMaps/">Moreland, 2009</a>):<br />
– The map yields images that are aesthetically pleasing<br />
– The map has a maximal perceptual resolution<br />
– Interference with the shading of 3D surfaces is minimal<br />
– The map is not sensitive to vision deficiencies<br />
– The order of the colors should be intuitively the same for all people<br />
– The perceptual interpolation matches the underlying scalars of the map</p>
<p>In his paper Moreland developed a new default color map that <a href="./../../../matlab-colorbar-with-gnuplot/comment-page-1/index.html#comment-3334">was mentioned already</a> in a user comment. In Fig. 1 the map is used to replot the photoluminescence yield plotted in an <a href="./../../../matlab-colorbar-with-gnuplot/index.html">earlier entry</a>.</p>
<div class="figure">
    <img decoding="async" src="./../../../figs/default_color_map1.png" alt="Default color map after Moreland, 2009"/></p>
<p class="caption">
        <strong>Fig. 1 </strong>Photoluminescence yield plotted with the default color map after <a href="http://www.sandia.gov/~kmorel/documents/ColorMaps/">Moreland, 2009</a> (<a href="./../../../code/default_color_map1.gnu" type="text/plain" rel="nofollow">code to produce this figure</a>, <a href="./../../../data/matlab_colormap.txt" rel="nofollow">data</a>)
    </p>
</div>
<p>To use the default color map proposed by Moreland, just download <a href="./../../../code/default.plt">default.plt</a> and store it to a path, that is available to gnuplot. For example store it under <code>/home/username/.gnuplotting/default.plt</code> and add the following line to your <code>.gnuplot</code> file.</p>
<pre class="prettyprint">
set loadpath "/home/username/.gnuplotting"
</pre>
<p>After that you can just load the palette before your plot command via</p>
<pre class="prettyprint">
load 'default.plt'
</pre>
<div class="figure">
    <img decoding="async" src="./../../../figs/default_color_map2.png" alt="Default gnuplot color palette"/></p>
<p class="caption">
        <strong>Fig. 2 </strong>Photoluminescence yield plotted with gnuplots default color palette (<a href="./../../../code/default_color_map2.gnu" type="text/plain" rel="nofollow">code to produce this figure</a>, <a href="./../../../data/matlab_colormap.txt" rel="nofollow">data</a>)
    </p>
</div>
<p>In Fig. 2 the same plot is shown using the default color map from gnuplot, which is a little bit dark in my opinion.</p>
<div class="figure">
    <img decoding="async" src="./../../../figs/default_color_map3.png" alt="Default Matlab color palette"/></p>
<p class="caption">
        <strong>Fig. 3 </strong>Photoluminescence yield plotted with Matlabs default color palette (<a href="./../../../code/default_color_map3.gnu" type="text/plain" rel="nofollow">code to produce this figure</a>, <a href="./../../../data/matlab_colormap.txt" rel="nofollow">data</a>)
    </p>
</div>
<p>Figure 3 shows the jet color map from Matlab, which is a classical rainbow map with all its pros and cons.</p>
]]></content:encoded>
					
					<wfw:commentRss>./../../../default-color-map/feed/index.html</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Configuration</title>
		<link>./../../../configuration/index.html</link>
					<comments>./../../../configuration/index.html#comments</comments>
		
		<dc:creator><![CDATA[hagen]]></dc:creator>
		<pubDate>Tue, 19 Apr 2011 09:23:02 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[style]]></category>
		<guid isPermaLink="false">http://gnuplot.kkdu.org/?p=130</guid>

					<description><![CDATA[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 [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>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 <code>.gnuplot</code> under Linux and <code>GNUPLOT.INI</code> under Windows. First it searches the current directory and then your home directory after that file.</p>
<p>Here is an example of what is possible to include in the startup file.</p>
<pre class="prettyprint">
<span class="C"># enable macros</span>
<span class="k">set</span> macros
<span class="C"># search for functions or data files in these directories</span>
<span class="k">set</span> loadpath <span class="v">'/usr/local/lib/gnuplot'</span>
<span class="C"># add default line colors</span>
<span class="k">set</span> style line <span class="n">1</span> lc rgb <span class="s">'#0060ad'</span> lt <span class="n">1</span> lw <span class="n">2</span> pt <span class="n">5</span>   <span class="C"># blue</span>
<span class="k">set</span> style line <span class="n">2</span> lc rgb <span class="s">'#dd181f'</span> lt <span class="n">1</span> lw <span class="n">2</span> pt <span class="n">7</span>   <span class="C"># red</span>
<span class="C"># add macros to select the desired line style</span>
<span class="v">BLUE</span> <span class="o">=</span> <span class="s">"1"</span>
<span class="v">RED</span> <span class="o">=</span> <span class="s">"2"</span>
<span class="C"># add macros to select a desired terminal</span>
<span class="v">WXT</span> <span class="o">=</span> <span class="s">"set terminal wxt size 350,262 enhanced font 'Verdana,10' \
   persist"</span>
<span class="v">PNG</span> <span class="o">=</span> <span class="s">"set terminal pngcairo size 350,262 enhanced font 'Verdana,10'"</span>
<span class="v">SVG</span> <span class="o">=</span> <span class="s">"set terminal svg size 350,262 fname \
   'Verdana, Helvetica, Arial, sans-serif' fsize = 10"</span>
</pre>
<p>With these settings and the use of macros our plotting will become more easier. For example to plot the sinusoid from the <a href="./../../../introduction/plotting-functions/index.html">plotting functions</a> introduction we can now use the following code.</p>
<pre class="prettyprint">
<span class="v">@WXT</span>
[...]
<span class="k">plot</span> <span class="f">f</span>(<span class="v">x</span>) title <span class="s">'sin(x)'</span> with lines ls <span class="v">@BLUE</span>, \
     <span class="f">g</span>(<span class="v">x</span>) notitle with lines ls <span class="v">@RED</span>
</pre>
<p>Note that you have to omit the usage of <code>reset</code> in your code, because it will clear the line style settings.</p>
<div class="figure">
    <object data="./../../../figs/configuration1.svg" type="image/svg+xml"><img decoding="async" src="./../../../figs/configuration1.png" alt="Sinusoid" width="350"/></object></p>
<p class="caption">
        <strong>Fig. 1 </strong>Plotting using the configuration file (<a href="./../../../code/configuration1.gnu" type="text/plain">code to produce this figure</a>)
    </p>
</div>
<p>You can of course override the style settings of the configuration file.</p>
<pre class="prettyprint">
<span class="k">plot</span> <span class="f">f</span>(<span class="v">x</span>) title <span class="s">'sin(x)'</span> with lines ls <span class="v">@BLUE</span>, \
     <span class="f">g</span>(<span class="v">x</span>) notitle with lines ls <span class="v">@RED</span> lw <span class="n">1</span>
</pre>
<div class="figure">
    <object data="./../../../figs/configuration2.svg" type="image/svg+xml"><img decoding="async" src="./../../../figs/configuration2.png" alt="Sinusoid" width="350"/></object></p>
<p class="caption">
        <strong>Fig. 1 </strong>Overwriting settings from the configuration file (<a href="./../../../code/configuration2.gnu" type="text/plain">code to produce this figure</a>)
    </p>
</div>
]]></content:encoded>
					
					<wfw:commentRss>./../../../configuration/feed/index.html</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
