<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://entorb.net//wiki/index.php?action=history&amp;feed=atom&amp;title=Gnuplot</id>
	<title>Gnuplot - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://entorb.net//wiki/index.php?action=history&amp;feed=atom&amp;title=Gnuplot"/>
	<link rel="alternate" type="text/html" href="https://entorb.net//wiki/index.php?title=Gnuplot&amp;action=history"/>
	<updated>2026-05-06T10:28:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://entorb.net//wiki/index.php?title=Gnuplot&amp;diff=4927&amp;oldid=prev</id>
		<title>Torben at 20:54, 30 October 2024</title>
		<link rel="alternate" type="text/html" href="https://entorb.net//wiki/index.php?title=Gnuplot&amp;diff=4927&amp;oldid=prev"/>
		<updated>2024-10-30T20:54:45Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Coding]][[Category:Software]]&lt;br /&gt;
===Basics===&lt;br /&gt;
 set datafile commentschars &amp;#039;#&amp;#039;&lt;br /&gt;
 set datafile missing &amp;#039;#&amp;#039;&lt;br /&gt;
 set datafile separator &amp;quot;\t&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Simple Plot &lt;br /&gt;
 data = &amp;#039;data.dat&amp;#039;&lt;br /&gt;
 plot data&lt;br /&gt;
 #or &lt;br /&gt;
 plot sin(x)&lt;br /&gt;
&lt;br /&gt;
Plot multiple lines&lt;br /&gt;
 plot\&lt;br /&gt;
  &amp;quot;1.dat&amp;quot; title &amp;quot;Eins&amp;quot;\&lt;br /&gt;
 ,&amp;quot;2.dat&amp;quot; title &amp;quot;Zwei&amp;quot;\&lt;br /&gt;
 ,&amp;quot;3.dat&amp;quot; title &amp;quot;Drei&amp;quot;\&lt;br /&gt;
&lt;br /&gt;
png output&lt;br /&gt;
 set terminal png giant size 1024,768&lt;br /&gt;
 set output &amp;quot;plot.png&amp;quot;&lt;br /&gt;
 plot sin(x)&lt;br /&gt;
 unset output&lt;br /&gt;
&lt;br /&gt;
Multiplot / 2 stacked plots&lt;br /&gt;
 set multiplot layout 2,1 columnsfirst&lt;br /&gt;
 plot sin(x)&lt;br /&gt;
 plot cos(x)&lt;br /&gt;
 unset multiplot&lt;br /&gt;
&lt;br /&gt;
Plot different columns of same file using 2 y-axes&lt;br /&gt;
 data = &amp;#039;data.dat&amp;#039;&lt;br /&gt;
 plot\&lt;br /&gt;
  data using 1:3 title &amp;quot;Drei&amp;quot; axes x1y2 \&lt;br /&gt;
 ,data using 1:2 title &amp;quot;Zwei&amp;quot;&lt;br /&gt;
&lt;br /&gt;
better:&lt;br /&gt;
 plot\&lt;br /&gt;
  data using (column(&amp;quot;X-Values&amp;quot;)):(column(&amp;quot;Drei&amp;quot;)) title &amp;quot;Drei&amp;quot; axes x1y2 \&lt;br /&gt;
 ,data using (column(&amp;quot;X-Values&amp;quot;)):(column(&amp;quot;Zwei&amp;quot;)) title &amp;quot;Zwei&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Common Mistakes / Errors====&lt;br /&gt;
Integer division:&amp;lt;br&amp;gt;&lt;br /&gt;
use 10.0 / 3 instead of 10/3&lt;br /&gt;
&lt;br /&gt;
====Plot Region of Function====&lt;br /&gt;
 plot \&lt;br /&gt;
   (x&amp;lt;=0.0)||(x&amp;gt;=0.5)?1/0:sin(x) \&lt;br /&gt;
 , (x&amp;lt;=0.5)||(x&amp;gt;=1.0)?1/0:cos(x)&lt;br /&gt;
&lt;br /&gt;
====Filter Data to Plot====&lt;br /&gt;
 plot data \&lt;br /&gt;
 using (column(&amp;quot;Date&amp;quot;)):(column(&amp;quot;Cases_Last_Week_Doubling_Time&amp;quot;)&amp;gt;0 ? column(&amp;quot;Cases_Last_Week_Doubling_Time&amp;quot;) : 1/0) \ &lt;br /&gt;
 title &amp;quot;Verdopplungszeit&amp;quot; axis x1y2 with lines ls 5 linecolor rgb &amp;quot;sea-green&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====String Functions====&lt;br /&gt;
get file base name of data file and add .png for outfile&lt;br /&gt;
 data = &amp;quot;myDatafile.dat&amp;quot;&lt;br /&gt;
 set output data[0:strlen(data)-4] . &amp;quot;.png&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Layout===&lt;br /&gt;
====Terminals====&lt;br /&gt;
 set terminal postscript enhanced eps color solid # solid!!!&lt;br /&gt;
 set terminal png enhanced giant size 1024,768&lt;br /&gt;
&lt;br /&gt;
For PostScript and MP you should&lt;br /&gt;
 set border back&lt;br /&gt;
as otherwise the frame is drawn twice (can be found using inkscape)&lt;br /&gt;
&lt;br /&gt;
My Favorite: Terminal MP (Metapost) (needs Latex and UbuntuPackage texlive-metapost)&lt;br /&gt;
&lt;br /&gt;
 #term = &amp;quot;png&amp;quot;&lt;br /&gt;
 term = &amp;quot;mp&amp;quot;&lt;br /&gt;
 if (term eq &amp;quot;png&amp;quot; ) set terminal png enhanced giant size 1024,768&lt;br /&gt;
 if (term eq &amp;quot;mp&amp;quot;  ) set terminal mp color solid latex psnfss prologues 2 magnification 1.00&lt;br /&gt;
 outfile=&amp;quot;plot123&amp;quot;&lt;br /&gt;
 set output outfile . &amp;quot;.&amp;quot; . term&lt;br /&gt;
  plot sin(x)&lt;br /&gt;
 unset output&lt;br /&gt;
 &lt;br /&gt;
 if (term eq &amp;quot;mp&amp;quot;  ) \&lt;br /&gt;
  system (&amp;quot;mpost -tex=latex &amp;#039;&amp;quot;.outfile.&amp;quot;.mp&amp;#039;&amp;quot;) &lt;br /&gt;
  ; system (&amp;quot;mv &amp;quot; . outfile . &amp;quot;.0 &amp;quot; . outfile .&amp;quot;.mps&amp;quot;) \&lt;br /&gt;
  ; system (&amp;quot;convert -density 300 &amp;quot;.outfile.&amp;quot;.mps &amp;quot;.outfile.&amp;quot;.png&amp;quot;) \&lt;br /&gt;
  ; system (&amp;quot;rm -f &amp;quot;.outfile.&amp;quot;.mpx&amp;quot;)&lt;br /&gt;
  ; system (&amp;quot;rm -f &amp;quot;.outfile.&amp;quot;.log&amp;quot;)&lt;br /&gt;
  ; system (&amp;quot;rm -f &amp;quot;.outfile.&amp;quot;.mp&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
====General====&lt;br /&gt;
 set title &amp;quot;Plot Title&amp;quot;&lt;br /&gt;
 # set default plot style&lt;br /&gt;
 set style function points&lt;br /&gt;
 # define linestyles&lt;br /&gt;
 set style line 1 lt 1 lw 2&lt;br /&gt;
 # Legend position&lt;br /&gt;
 set key top right # or set key off&lt;br /&gt;
 # advanced:&lt;br /&gt;
 set key bottom left box width -3 reverse Left samplen 2 #invert title &amp;quot;Sinus&amp;quot;&lt;br /&gt;
 # default:&lt;br /&gt;
 set key on right top vertical Right noreverse noinvert samplen 4 spacing 1.25 title &amp;quot;&amp;quot; nobox&lt;br /&gt;
&lt;br /&gt;
====Axes====&lt;br /&gt;
 set xlabel &amp;quot;Time (s)&amp;quot;&lt;br /&gt;
 set ylabel &amp;quot;Current (A)&amp;quot;&lt;br /&gt;
 set grid xtics ytics&lt;br /&gt;
 &lt;br /&gt;
 # set tics&lt;br /&gt;
 set xtics mirror&lt;br /&gt;
 set ytics mirror &lt;br /&gt;
 # add some tics&lt;br /&gt;
 set xtics add (0.003, 0.03, 0.3) &lt;br /&gt;
 set xtics add (&amp;quot;Pi&amp;quot; 3.14159)&lt;br /&gt;
 &lt;br /&gt;
 # Disable autorange of axes&lt;br /&gt;
 set xrange [1:*]&lt;br /&gt;
 set yrange [2.8E-08:3.0E-08]&lt;br /&gt;
 set logscale y&lt;br /&gt;
 # set format of number to 1e-03 etc&lt;br /&gt;
 set format y &amp;quot;%1.e&amp;quot;&lt;br /&gt;
 # 10^x&lt;br /&gt;
 set format y &amp;quot;10^{%L}&amp;quot;&lt;br /&gt;
 # &amp;quot;%&amp;quot; sign:&lt;br /&gt;
 set format y &amp;quot;%g%%&amp;quot;&lt;br /&gt;
 # % sign in Terminal MP (Latex)&lt;br /&gt;
 set format y &amp;quot;%g&amp;quot;.&amp;#039;\%%&amp;#039;&lt;br /&gt;
 # NullAchsen einfügen&lt;br /&gt;
 set zeroaxis&lt;br /&gt;
 # or&lt;br /&gt;
 set xzeroaxis ls -1 lw 2&lt;br /&gt;
&lt;br /&gt;
====Date/Time Axis====&lt;br /&gt;
 set timefmt &amp;#039;%Y-%m-%d&amp;#039; # %d.%m.%Y %H:%M&lt;br /&gt;
 set format x &amp;#039;%d.%m&amp;#039;&lt;br /&gt;
 set xdata time&lt;br /&gt;
 set xrange [&amp;quot;2020-03-01&amp;quot;:]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using offset in time axis&lt;br /&gt;
 plot data u (column(&amp;quot;Date&amp;quot;)):(column(&amp;quot;Deaths_Last_Week_Per_Million&amp;quot;)) t &amp;quot;Tote&amp;quot; axes x1y2 with lines ls 2, \&lt;br /&gt;
      data u (timecolumn(2)-14*24*3600):(column(&amp;quot;Deaths_Last_Week_Per_Million&amp;quot;)) t &amp;quot;Tote verschoben um 14 Tage&amp;quot; axes x1y2 with lines ls 3&lt;br /&gt;
 unset output&lt;br /&gt;
&lt;br /&gt;
====Linked axes====&lt;br /&gt;
Variant 1&lt;br /&gt;
Linked tics on top axes e.g. bottom=nanometer/top=eV&lt;br /&gt;
[http://www.boyfarrell.com/learning-curve/linked-axes-in-gnuplot]&lt;br /&gt;
&lt;br /&gt;
 set x2label &amp;quot;Temp (C)&amp;quot;&lt;br /&gt;
 set x2tics (\&lt;br /&gt;
    &amp;quot;25&amp;quot; 1000/(c0C+25) \&lt;br /&gt;
 ,  &amp;quot;50&amp;quot; 1000/(c0C+50) \&lt;br /&gt;
 ,  &amp;quot;75&amp;quot; 1000/(c0C+75) \&lt;br /&gt;
 ,  &amp;quot;100&amp;quot; 1000/(c0C+100) \&lt;br /&gt;
 ,  &amp;quot;125&amp;quot; 1000/(c0C+125) \&lt;br /&gt;
 )&lt;br /&gt;
Important: you have to set plot range for x and x2!!!&lt;br /&gt;
 plot [xmin:xmax] [*:*] [xmin:xmax]&lt;br /&gt;
&lt;br /&gt;
Links:&lt;br /&gt;
[http://www.duke.edu/~hpgavin/gnuplot.html]&lt;br /&gt;
&lt;br /&gt;
Variant 2: easier&lt;br /&gt;
 plot sin(x)&lt;br /&gt;
 set y2range[0:GPVAL_Y_MAX/1.60934] # km -&amp;gt; mile&lt;br /&gt;
 set y2tics&lt;br /&gt;
 replot&lt;br /&gt;
&lt;br /&gt;
====Add Text to Plot====&lt;br /&gt;
 set label &amp;quot;text&amp;quot; at 3.3e-3,90e-3&lt;br /&gt;
 plot ...&lt;br /&gt;
 &lt;br /&gt;
 set label 1 sprintf(&amp;quot;Ea = %3.5g&amp;quot;,-b*ckb/ce) at 3.3e-3,90e-3&lt;br /&gt;
 plot ...&lt;br /&gt;
 unset label 1&lt;br /&gt;
 # position can be given via differnet systems: first (=x axes), second (=x2 axes), graph (=pos in graph area 0.0..1.0) , screen, character&lt;br /&gt;
 # see help set coordinates&lt;br /&gt;
 set label &amp;quot;text&amp;quot; at graph 0.25, graph 0.75&lt;br /&gt;
&lt;br /&gt;
====Colors====&lt;br /&gt;
set color of axes label or tics to that of line XYZ&lt;br /&gt;
 set ylabel &amp;quot;Label&amp;quot; textcolor lt 1&lt;br /&gt;
 set ytics textcolor lt 1&lt;br /&gt;
&lt;br /&gt;
====Draw Line/Arrow====&lt;br /&gt;
 set arrow nohead from 0,0 rto 10,1&lt;br /&gt;
 set arrow from fitLow, graph 0 to fitLow, graph 1 nohead lc -1 lw 2&lt;br /&gt;
 plot ...&lt;br /&gt;
 unset arrow&lt;br /&gt;
Note: set arrow must be placed before the plot command&lt;br /&gt;
&lt;br /&gt;
line at y=0 in date plot&lt;br /&gt;
 set arrow nohead from graph 0, first 0 to graph 1, first 0&lt;br /&gt;
&lt;br /&gt;
Draw circle, rectangle, ellipse, or polygon&lt;br /&gt;
 set object 1 circle at xwert , ywert behind&lt;br /&gt;
&lt;br /&gt;
====Adjusting Margins/Distances====&lt;br /&gt;
Axis label closer to tics (unit = characters, other units possible as well)&lt;br /&gt;
 set xlabel offset 0.0,0.5&lt;br /&gt;
 set ylabel offset 1.5,0.0&lt;br /&gt;
 set x2label offset 0.0,-0.5&lt;br /&gt;
 set y2label offset -1.5,0.0&lt;br /&gt;
&lt;br /&gt;
margins: (l,r,t,bmargin)&lt;br /&gt;
 set lmargin 3 # unit chars&lt;br /&gt;
 set lmargin at screen 0.1 # useful for multiplots&lt;br /&gt;
&lt;br /&gt;
====Fonts====&lt;br /&gt;
in Linux run &lt;br /&gt;
 export GDFONTPATH=/usr/share/fonts/truetype/msttcorefonts&lt;br /&gt;
than you can use all the fonts in that dir. For example&lt;br /&gt;
 set terminal png giant font &amp;quot;Arial,24&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Latex Fonts=====&lt;br /&gt;
From [http://wiki.ubuntuusers.de/Gnuplot], needs Linux package &amp;quot;cm-super&amp;quot;)&lt;br /&gt;
 set term postscript fontfile &amp;#039;/usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb&amp;#039; &amp;quot;SFRM1000&amp;quot;&lt;br /&gt;
or after copying the file&lt;br /&gt;
 set term postscript fontfile &amp;#039;/MessSoftware/sfrm1000.pfb&amp;#039; &amp;quot;SFRM1000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=====Greek Symbols in Latex=====&lt;br /&gt;
To get a greek letter, you have to use the &amp;#039;&amp;#039;postscript terminal&amp;#039;&amp;#039;, with the option &amp;#039;&amp;#039;enhanced&amp;#039;&amp;#039;. Then, to add the alpha greek letter, you have to type &amp;#039;&amp;#039;{/Symbol a}&amp;#039;&amp;#039;. Analogously for other letters, changing the &amp;quot;a&amp;quot; by other, like &amp;quot;D&amp;quot; for Delta and so on...&lt;br /&gt;
[http://ontublog.blogspot.com/2009/09/greek-letters-in-gnuplot.html]&lt;br /&gt;
&lt;br /&gt;
====Modify Default Line Types/Styles====&lt;br /&gt;
 set style increment user # important!!! switch between linetypes (default) and userdefined linestyles&lt;br /&gt;
 set style line  1 linewidth 2 pointsize 2 linecolor rgb &amp;quot;blue&amp;quot;&lt;br /&gt;
 set style line  2 linewidth 2 pointsize 2 linetype 7&lt;br /&gt;
 set style line  3 linewidth 2 pointsize 2&lt;br /&gt;
&lt;br /&gt;
===Fitting===&lt;br /&gt;
 b=5&lt;br /&gt;
 f(x) = x**b&lt;br /&gt;
 fit f(x) &amp;quot;data.dat&amp;quot; using 1:2 via b&lt;br /&gt;
 plot &amp;quot;data.dat&amp;quot; title &amp;quot;data&amp;quot; notitle, f(x) title &amp;quot;fit&amp;quot;&lt;br /&gt;
 # to weight the data (here by y^(-2)) use sth like the following:&lt;br /&gt;
 # fit f(x) &amp;quot;data.dat&amp;quot; using 1:2:(1./$2**2) via b&lt;br /&gt;
 f05(x)=a05*exp(b05*x)+0&lt;br /&gt;
 fit [0.003:0.006] f05(x) &amp;quot;V6_05.dat&amp;quot; using (1./(($3/2+$4/2)+273.15)):($2*5380716) via a05,b05&lt;br /&gt;
 a=1; b=1&lt;br /&gt;
 f(x)=a*exp(b*x)&lt;br /&gt;
 fitLow =0.0030&lt;br /&gt;
 fitHigh=0.0055&lt;br /&gt;
 fit [fitLow:fitHigh] f(x) &amp;quot;data.dat&amp;quot; via a,b&lt;br /&gt;
 print a,b&lt;br /&gt;
 set output &amp;quot;png/fit.png&amp;quot;&lt;br /&gt;
 plot \&lt;br /&gt;
   &amp;quot;data.dat&amp;quot; title  &amp;quot;5V&amp;quot; with points pointsize 0.2\&lt;br /&gt;
 , (x&amp;lt;=fitLow)||(x&amp;gt;=fitHigh)?1/0:f(x) notitle with lines \&lt;br /&gt;
 unset output&lt;br /&gt;
&lt;br /&gt;
====Interpolate====&lt;br /&gt;
 smooth csplines&lt;br /&gt;
&lt;br /&gt;
====Advanced Fitting====&lt;br /&gt;
 FIT_LIMIT = 1e-8 # or even smaller&lt;br /&gt;
&lt;br /&gt;
[http://gnuplot-tricks.blogspot.com/2009/12/restricting-fit-parameters.html restricting fit parameters]&lt;br /&gt;
 f(x) = a   *exp(-(x-b   )*(x-b   )/c   /c   ) &lt;br /&gt;
 g(x) = A(a)*exp(-(x-B(b))*(x-B(b))/C(c)/C(c))&lt;br /&gt;
 &lt;br /&gt;
 # trick: use atan as restriction function&lt;br /&gt;
 A(x) = (2.0-1.1)/pi*(atan(x)+pi/2)+1.1 # Restrict a to the range of [1.1:2.0]&lt;br /&gt;
 B(x) = (0.9-0.1)/pi*(atan(x)+pi/2)+0.1 # Restrict b to the range of [0.1:0.9]&lt;br /&gt;
 C(x) = (1.5-0.5)/pi*(atan(x)+pi/2)+0.5 # Restrict c to the range of [0.5:1.5]&lt;br /&gt;
 &lt;br /&gt;
 a =0.0 ; b =0.5 ; c =0.9 ; &lt;br /&gt;
 fit f(x) &amp;#039;data.dat&amp;#039; via a, b, c&lt;br /&gt;
 aa=1.5 ; bb=0.5 ; cc=0.9 ;&lt;br /&gt;
 fit g(x) &amp;#039;data.dat&amp;#039; via aa, bb, cc&lt;br /&gt;
 plot &amp;quot;data.dat&amp;quot; , f(x) , g(x)&lt;br /&gt;
 &lt;br /&gt;
 print A(aa), B(bb), C(cc) # do NOT use aa, bb, cc as they are not what you want!!!&lt;br /&gt;
&lt;br /&gt;
===Stats===&lt;br /&gt;
In GP Ver&amp;gt;4.6 the new function stats is quite convenient.&lt;br /&gt;
 stats data&lt;br /&gt;
 STATS_records # total number of in-range data records&lt;br /&gt;
 STATS_min     # minimum value of in-range data points&lt;br /&gt;
 STATS_max     # maximum value of in-range data points&lt;br /&gt;
 STATS_mean    # ...&lt;br /&gt;
 STATS_median&lt;br /&gt;
 STATS_stddev  # standard deviation&lt;br /&gt;
 STATS_pos_min_y  # x coordinate of a point with minimum y value&lt;br /&gt;
 STATS_pos_max_y  # x coordinate of a point with maximum y value&lt;br /&gt;
&lt;br /&gt;
====Finding Min and Max for X and Y====&lt;br /&gt;
In GP Ver 4.2 (and above) these tricks, stolen from [http://www.phyast.pitt.edu/~zov1/gnuplot/html/statistics.html] are handy&lt;br /&gt;
 data = &amp;#039;stats2.dat&amp;#039;&lt;br /&gt;
 # Retrieve statistical properties via dummy plot&lt;br /&gt;
 plot data u 1:2&lt;br /&gt;
 min_y = GPVAL_DATA_Y_MIN&lt;br /&gt;
 max_y = GPVAL_DATA_Y_MAX&lt;br /&gt;
 min_x = GPVAL_DATA_X_MIN&lt;br /&gt;
 max_x = GPVAL_DATA_X_MAX&lt;br /&gt;
 &lt;br /&gt;
 # X Pos of min_y and max_y&lt;br /&gt;
 plot data u ($2 == min_y ? $2 : 1/0):1&lt;br /&gt;
 min_y_x_pos = GPVAL_DATA_Y_MIN&lt;br /&gt;
 plot data u ($2 == max_y ? $2 : 1/0):1&lt;br /&gt;
 max_y_x_pos = GPVAL_DATA_Y_MAX&lt;br /&gt;
 &lt;br /&gt;
 # Mean via fit + Std Deviation&lt;br /&gt;
 f(x) = mean_y&lt;br /&gt;
 fit f(x) data u 1:2 via mean_y&lt;br /&gt;
 stddev_y = sqrt(FIT_WSSR / (FIT_NDF + 1 ))&lt;br /&gt;
&lt;br /&gt;
====Histogram====&lt;br /&gt;
 data=&amp;quot;data.dat&amp;quot;&lt;br /&gt;
 stats data # retrieve STATS_ variables ...&lt;br /&gt;
 rows = STATS_records # num values&lt;br /&gt;
 mu    = STATS_mean_y&lt;br /&gt;
 sigma = STATS_stddev_y  # standard deviation&lt;br /&gt;
 &lt;br /&gt;
 # histogram parameters&lt;br /&gt;
 width=0.5 # box width (units of x!)&lt;br /&gt;
 max = 0.0+ceil(mu+3*sigma) # plot range max&lt;br /&gt;
 min = 0.0+floor(mu-3*sigma) # plot range min&lt;br /&gt;
 &lt;br /&gt;
 # gaussean function&lt;br /&gt;
 gauss(x) = 1. / (sigma * sqrt(2 * pi)) * exp(-(x - mu)**2 / (2 * sigma**2))&lt;br /&gt;
 # histogram function&lt;br /&gt;
 hist(x) = width * floor(x / width) + width / 2.0&lt;br /&gt;
 &lt;br /&gt;
 # some settings&lt;br /&gt;
 set key off&lt;br /&gt;
 set tics out&lt;br /&gt;
 set xrange [min:max] ; set x2range [min:max]&lt;br /&gt;
 set yrange [0:]&lt;br /&gt;
 set y2range [0:]&lt;br /&gt;
 set grid x2tics ytics&lt;br /&gt;
 # set xtics min, (max - min)/4.0, max&lt;br /&gt;
 set x2tics (&amp;quot;-3s&amp;quot; mu-3*sigma, &amp;quot;-2s&amp;quot; mu-2*sigma, &amp;quot;-1s&amp;quot; mu-1*sigma, &amp;quot;µ&amp;quot; mu, &amp;quot;1s&amp;quot; mu+1*sigma, &amp;quot;2s&amp;quot; mu+2*sigma, &amp;quot;3s&amp;quot; mu+3*sigma)&lt;br /&gt;
 set boxwidth width&lt;br /&gt;
 set style fill solid 0.5&lt;br /&gt;
 set tics out nomirror&lt;br /&gt;
 set xlabel &amp;quot;Value&amp;quot;&lt;br /&gt;
 set ylabel &amp;quot;rel. Density&amp;quot;&lt;br /&gt;
 set format x &amp;quot;%g&amp;quot;&lt;br /&gt;
 set format y &amp;quot;%g %%&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 plot \&lt;br /&gt;
    data using (hist($1)):(100.0 / rows) smooth freq w boxes lc rgb&amp;quot;red&amp;quot; notitle \&lt;br /&gt;
  , gauss(x) * sigma * sqrt(2*pi) axes x1y2 notitle lc rgb&amp;quot;blue&amp;quot; lw 2 &lt;br /&gt;
 unset output&lt;br /&gt;
&lt;br /&gt;
=====Historam with logscale=====&lt;br /&gt;
GnuPlot 5.0 has a [https://sourceforge.net/p/gnuplot/bugs/1263/ bug] combining logscale and smooth frequency, workaround:&lt;br /&gt;
 unset logscale y &lt;br /&gt;
 set table &amp;#039;hist_ temp.dat&amp;#039;&lt;br /&gt;
 plot \&lt;br /&gt;
   data using (hist($2)):(1.0) smooth frequency &lt;br /&gt;
 unset table&lt;br /&gt;
 plot &amp;#039;hist_temp.dat&amp;#039; using 1:2&lt;br /&gt;
improved version, after finding a second [http://stackoverflow.com/questions/32523266/gnuplot-data-table-type-value-u-and-strange-bars-in-histogram-boxes bug], and using memory instead of file for table&lt;br /&gt;
 unset logscale y &lt;br /&gt;
 set table $histtabledata  #&amp;#039;hist_temp.dat&amp;#039;&lt;br /&gt;
 plot \&lt;br /&gt;
   data using (hist($2)):(1.0) smooth frequency w points&lt;br /&gt;
 unset table&lt;br /&gt;
 plot $histtabledata using 1:($2 == 0 || strcol(3) eq &amp;quot;u&amp;quot; ? 1/0 : $2) w boxes lc rgb&amp;quot;red&amp;quot; notitle&lt;br /&gt;
 # 1:0 -&amp;gt; $2 == 0 || strcol(3) eq &amp;quot;u&amp;quot; ? 1/0 : $2&lt;br /&gt;
&lt;br /&gt;
===Misc===&lt;br /&gt;
&lt;br /&gt;
====Bar/Box Chart Plot====&lt;br /&gt;
 set style fill solid 0.5 border 0&lt;br /&gt;
 set boxwidth 0.75 relative&lt;br /&gt;
 plot data u 3:xticlabels(1) with boxes&lt;br /&gt;
 # y = data column 3&lt;br /&gt;
 # x label = data column 1&lt;br /&gt;
&lt;br /&gt;
=====Stacked Boxes via histogram rowstacked===== &lt;br /&gt;
 # settings for boxes&lt;br /&gt;
 set style data histograms&lt;br /&gt;
 set style histogram rowstacked&lt;br /&gt;
 set boxwidth 1 relative&lt;br /&gt;
 set style fill solid 1.0 border -1&lt;br /&gt;
 &lt;br /&gt;
 plot data using 3:xticlabels(1)&lt;br /&gt;
&lt;br /&gt;
====Errorbars====&lt;br /&gt;
 plot data u ($1):($5):(0.1*$1):(0.1*$5) w xyerrorbars ps 0&lt;br /&gt;
 plot data u ($1):($5):(0.1*$1) w xerrorbars&lt;br /&gt;
 plot data u ($1):($5):(0.1*$5) w yerrorbars&lt;br /&gt;
&lt;br /&gt;
====Dashed lines====&lt;br /&gt;
In terminal mp (which I prefere) use terminal option dashed and redefine the linestyles using lt 1 (solid) as template&lt;br /&gt;
 set style line 1 lt 1 linecolor rgb &amp;quot;red&amp;quot;&lt;br /&gt;
 set style line 2 lt 1 linecolor rgb &amp;quot;blue&amp;quot;&lt;br /&gt;
 set style line 3 lt 1 linecolor rgb &amp;quot;magenta&amp;quot;&lt;br /&gt;
Furthermore define how your dashed (e.g. lt 6 as template) line shall look like and define e.g. ls 30 to it&lt;br /&gt;
 set style line 30 lt 6 lw 1 linecolor rgb &amp;quot;dark-green&amp;quot;&lt;br /&gt;
Now you can plot data and line by&lt;br /&gt;
 plot data u 1:5 ls 2&lt;br /&gt;
 set arrow from 0.55, graph 0 to 0.55, graph 1 nohead ls 30 back&lt;br /&gt;
&lt;br /&gt;
====Number or points to plot for analytic function====&lt;br /&gt;
 set samples 200 # default = 100&lt;br /&gt;
&lt;br /&gt;
====pause====&lt;br /&gt;
you can use &lt;br /&gt;
 pause mouse&lt;br /&gt;
to let gnuplot stop continuing until you click the mouse&lt;br /&gt;
&lt;br /&gt;
====extract a &amp;quot;cell&amp;quot; from data file====&lt;br /&gt;
 # fetch data_file from last row, 2nd column of data (cut assumes tab separating by default)&lt;br /&gt;
 value = system(&amp;quot;tail -1 &amp;quot; . data_file . &amp;quot; | cut -f2)&lt;br /&gt;
&lt;br /&gt;
====Find number of data points====&lt;br /&gt;
Better use Gnuplot way, see [[Gnuplot#Stats|Stats]] above&lt;br /&gt;
&lt;br /&gt;
Version 1: count lines&lt;br /&gt;
 set table &amp;quot;temptable.dat&amp;quot;&lt;br /&gt;
 plot [fitLow0:fitHigh0] data using 1:3&lt;br /&gt;
 unset table&lt;br /&gt;
 pointsInRange0 = 0.0 + system (sprintf(&amp;quot;grep -P &amp;#039;  i&amp;#039; temptable.dat | wc -l&amp;quot;))&lt;br /&gt;
 system (&amp;quot;rm temptable.dat&amp;quot;) ; system (&amp;quot;del temptable.dat&amp;quot;)&lt;br /&gt;
 &lt;br /&gt;
Version 2: count lines where first value is in range min .. max&lt;br /&gt;
 numPointsInRange (datafile, min, max, col) = 0 + system (&amp;quot;perl -e &amp;#039;\&lt;br /&gt;
   $c = 0; \&lt;br /&gt;
   while ( &amp;lt;&amp;gt; ) { \&lt;br /&gt;
   $x = ( split /\t/ )[ 0 ]; \&lt;br /&gt;
   $y = ( split /\t/ )[ &amp;quot;.sprintf(&amp;quot;%d&amp;quot;,col - 1).&amp;quot;]; \&lt;br /&gt;
   if (     $x =~ m/^[0-9\.]+$/ \&lt;br /&gt;
         and $y =~ m/^[0-9\.]+$/ \&lt;br /&gt;
         and $y &amp;gt; 0 \&lt;br /&gt;
         and $x &amp;gt;= &amp;quot;.sprintf(&amp;quot;%.1f&amp;quot;, min).&amp;quot; \&lt;br /&gt;
         and $x &amp;lt;= &amp;quot;.sprintf(&amp;quot;%.1f&amp;quot;, max).&amp;quot; ) \&lt;br /&gt;
      {$c++;} \&lt;br /&gt;
   }  print $c; \&lt;br /&gt;
 &amp;#039; &amp;lt; &amp;quot;. datafile)&lt;br /&gt;
 print numPointsInRange (data, date_min, fitHigh0, 12)&lt;br /&gt;
&lt;br /&gt;
====Find min / max value====&lt;br /&gt;
Better use Gnuplot way, see [[Gnuplot#Stats|Stats]] above&lt;br /&gt;
&lt;br /&gt;
using Perl&lt;br /&gt;
 max=`! perl -e &amp;#039;$max=-1e38; while (&amp;lt;&amp;gt;) {@t=split;  $max=$t[1] if $t[1]&amp;gt;$max}; print $max&amp;#039; &amp;lt; 22.5.dat`&lt;br /&gt;
 min=`! perl -e &amp;#039;$min=+1e38; while (&amp;lt;&amp;gt;) {@t=split;  $min=$t[1] if $t[1]&amp;lt;$min}; print $min&amp;#039; &amp;lt; 22.5.dat`&lt;br /&gt;
 print min,max&lt;br /&gt;
&lt;br /&gt;
Version 2&lt;br /&gt;
 s = &amp;#039;$col=2; $f=&amp;#039;.&amp;quot;&amp;#039;&amp;quot;.data.&amp;quot;&amp;#039;&amp;quot;.&amp;#039;; use warnings; \&lt;br /&gt;
   open (FH, $f); @a = grep {not m/^#/ and not m/^\s*$/ } &amp;lt;FH&amp;gt;; close FH; \&lt;br /&gt;
   @t=split /\t/ , shift @a ; $x=$t[$col-1];  print $x &amp;#039;&lt;br /&gt;
 first=0.0+system(&amp;quot;perl -e \&amp;quot;&amp;quot;.s.&amp;quot;\&amp;quot;&amp;quot;)&lt;br /&gt;
 print first&lt;br /&gt;
 &lt;br /&gt;
 s = &amp;#039;$col=2; $f=&amp;#039;.&amp;quot;&amp;#039;&amp;quot;.data.&amp;quot;&amp;#039;&amp;quot;.&amp;#039;; use warnings; \&lt;br /&gt;
   open (FH, $f); @a = grep {not m/^#/ and not m/^\s*$/ } &amp;lt;FH&amp;gt;; close FH; \&lt;br /&gt;
   @t=split /\t/ , pop @a ; $x=$t[$col-1];  print $x &amp;#039;&lt;br /&gt;
 last=0.0+system(&amp;quot;perl -e \&amp;quot;&amp;quot;.s.&amp;quot;\&amp;quot;&amp;quot;)&lt;br /&gt;
 print last&lt;br /&gt;
 &lt;br /&gt;
 s = &amp;#039;$col=2; $f=&amp;#039;.&amp;quot;&amp;#039;&amp;quot;.data.&amp;quot;&amp;#039;&amp;quot;.&amp;#039;; use warnings; $x=1e38;\&lt;br /&gt;
   open (FH, $f); @a = grep {not m/^#/ and not m/^\s*$/ } &amp;lt;FH&amp;gt;; close FH; \&lt;br /&gt;
   while ($l=shift @a) { @t=split /\t/,$l ; next if $#t&amp;lt;$col-1 ; $x=$t[$col-1] if $t[$col-1]&amp;lt;$x;} ;  print $x &amp;#039;&lt;br /&gt;
 min=0.0+system(&amp;quot;perl -e \&amp;quot;&amp;quot;.s.&amp;quot;\&amp;quot;&amp;quot;)&lt;br /&gt;
 print min&lt;br /&gt;
 &lt;br /&gt;
 s = &amp;#039;$col=2; $f=&amp;#039;.&amp;quot;&amp;#039;&amp;quot;.data.&amp;quot;&amp;#039;&amp;quot;.&amp;#039;; use warnings; $x=-1e38;\&lt;br /&gt;
   open (FH, $f); @a = grep {not m/^#/ and not m/^\s*$/ } &amp;lt;FH&amp;gt;; close FH; \&lt;br /&gt;
   while ($l=shift @a) { @t=split /\t/,$l ; next if $#t&amp;lt;$col-1 ; $x=$t[$col-1] if $t[$col-1]&amp;gt;$x;} ;  print $x &amp;#039;&lt;br /&gt;
 max=0.0+system(&amp;quot;perl -e \&amp;quot;&amp;quot;.s.&amp;quot;\&amp;quot;&amp;quot;)&lt;br /&gt;
 print max&lt;br /&gt;
&lt;br /&gt;
Version 2a - Linux ( excape $)&lt;br /&gt;
 s = &amp;#039;\$col=2; \$f=&amp;#039;.&amp;quot;&amp;#039;&amp;quot;.d.&amp;quot;&amp;#039;&amp;quot;.&amp;#039;; use warnings; \&lt;br /&gt;
   open (FH, \$f); @a = grep {not m/^#/ and not m/^\s*$/ } &amp;lt;FH&amp;gt;; close FH; \&lt;br /&gt;
   @t=split /\t/ , shift @a ; \$x=\$t[\$col-1];  print \$x &amp;#039;&lt;br /&gt;
&lt;br /&gt;
Version 3 (when using Perl to gen Gnuplot script)&lt;br /&gt;
 my $colX=3; my $colY=2; &lt;br /&gt;
 open (FH, $f);&lt;br /&gt;
 my @a = grep {not m/^#/ and not m/^\s*$/} &amp;lt;FH&amp;gt;;&lt;br /&gt;
 close FH;&lt;br /&gt;
 my @b=split /\t/ , pop @a ; &lt;br /&gt;
 my $lastX=$b[$colX-1];&lt;br /&gt;
 my $lastY=$b[$colY-1];&lt;br /&gt;
 &lt;br /&gt;
 $cont .= &amp;quot;set object 1 circle at $lastX , ($lastY*1E9) behind\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
====Values of Tics in Logscale====&lt;br /&gt;
of only 3 minor tics are visible they are at 0.2 ; 0.5 ; 0.8&lt;br /&gt;
&lt;br /&gt;
====Variables====&lt;br /&gt;
 a=123&lt;br /&gt;
 print &amp;quot;Variable a=&amp;quot;,a&lt;br /&gt;
 undef a&lt;br /&gt;
=====Export (fit-)Variables=====&lt;br /&gt;
 a=12&lt;br /&gt;
 # not so good...    system(sprintf(&amp;quot;echo A=%d &amp;gt;testausgabe.txt&amp;quot;,a))&lt;br /&gt;
 set print &amp;quot;../data/cases-de-gnuplot-fit.csv&amp;quot; append&lt;br /&gt;
 print a&lt;br /&gt;
 unset print&lt;br /&gt;
&lt;br /&gt;
===Schnippsel===&lt;br /&gt;
 c0C = 273.15&lt;br /&gt;
 ckb = 1.38e-23&lt;br /&gt;
 ce  = 1.602e-19&lt;br /&gt;
 ckbeV = ckb/ce&lt;br /&gt;
&lt;br /&gt;
 set x2tics (\&lt;br /&gt;
    &amp;quot;25&amp;quot; (c0C+25) \&lt;br /&gt;
 ,  &amp;quot;50&amp;quot; (c0C+50) \&lt;br /&gt;
 ,  &amp;quot;75&amp;quot; (c0C+75) \&lt;br /&gt;
 ,  &amp;quot;100&amp;quot; (c0C+100) \&lt;br /&gt;
 ,  &amp;quot;125&amp;quot; (c0C+125) \&lt;br /&gt;
 )&lt;br /&gt;
WARNING: you have to set x2 AND x ranges to the same! (so no autorange :-()&lt;br /&gt;
&lt;br /&gt;
====Multiplot V3 : 2x2====&lt;br /&gt;
 #!/usr/bin/gnuplot&lt;br /&gt;
 &lt;br /&gt;
 term=&amp;quot;eps&amp;quot;&lt;br /&gt;
 color=&amp;quot;sw&amp;quot;&lt;br /&gt;
 color=&amp;quot;color&amp;quot;&lt;br /&gt;
 outtype=&amp;quot;png-trans&amp;quot;&lt;br /&gt;
 outtype=&amp;quot;png-solid&amp;quot;&lt;br /&gt;
 outtype=&amp;quot;pdf&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if (color eq &amp;quot;sw&amp;quot;)    set terminal postscript monochrome&lt;br /&gt;
 if (color eq &amp;quot;color&amp;quot;) set terminal postscript color&lt;br /&gt;
 set terminal postscript eps enhanced clip dashed size 15cm,15cm font &amp;quot;,22pt&amp;quot;&lt;br /&gt;
 #fontfile add &amp;quot;uopr8a.pfa&amp;quot; fontfile add &amp;quot;uopri8a.pfa&amp;quot; fontfile add &amp;quot;uopb8a.pfa&amp;quot; font &amp;quot;URWClassico-Reg,22pt&amp;quot; # 10x7 # fontsize 14 = default&lt;br /&gt;
 &lt;br /&gt;
 set encoding utf8&lt;br /&gt;
 set border back&lt;br /&gt;
 &lt;br /&gt;
 set style data points&lt;br /&gt;
 set style function lines&lt;br /&gt;
 &lt;br /&gt;
 set style increment user&lt;br /&gt;
 # LineWitdh + Symbols&lt;br /&gt;
 set style line  1 lw 4 ps 3 pointtype  8 #= dreieck oben&lt;br /&gt;
 set style line  2 lw 4 ps 3 pointtype 10 #= dreieck unten&lt;br /&gt;
 &lt;br /&gt;
 if (color eq &amp;quot;sw&amp;quot;) set style line  1 lt 1 # voll&lt;br /&gt;
 if (color eq &amp;quot;sw&amp;quot;) set style line  2 lt 5 # Strich-Punkt&lt;br /&gt;
 if (color eq &amp;quot;color&amp;quot;) set style line  1 lt 1 linecolor rgb &amp;quot;red&amp;quot;&lt;br /&gt;
 if (color eq &amp;quot;color&amp;quot;) set style line  2 lt 1 linecolor rgb &amp;quot;blue&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # grid&lt;br /&gt;
 set style line 40 lt 1 lw 2 linecolor rgb &amp;quot;grey70&amp;quot;&lt;br /&gt;
 set grid ls 40&lt;br /&gt;
 &lt;br /&gt;
 set ytics  .4&lt;br /&gt;
 set y2tics .4&lt;br /&gt;
 set yrange  [-1.2:+1.4]&lt;br /&gt;
 set y2range [-1.2:+1.4]&lt;br /&gt;
 set mytics  4 # minor ytics&lt;br /&gt;
 set my2tics 4&lt;br /&gt;
 set samples 300&lt;br /&gt;
 &lt;br /&gt;
 # text will be inserted later on&lt;br /&gt;
 set label 2 &amp;quot;&amp;quot; left front font &amp;quot;,20&amp;quot; at graph 0.05, graph 0.90&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 marL=0.12&lt;br /&gt;
 marT=0.04&lt;br /&gt;
 plotX=(1.0-marL-0.005)/2&lt;br /&gt;
 plotY=plotX/1.618 # Golden Ratio = a:b = 1.618&lt;br /&gt;
 &lt;br /&gt;
 set key box height 0.1 width -2 reverse noinvert Left opaque samplen 1 font &amp;quot;,18&amp;quot;&lt;br /&gt;
 set key t l at screen marL + 0.85*plotX, screen 1.0-marT-1.25*plotY&lt;br /&gt;
 set key off&lt;br /&gt;
 &lt;br /&gt;
 set output &amp;quot;plot&amp;quot; . &amp;quot;.gp&amp;quot; . term&lt;br /&gt;
 set multiplot&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # (a)&lt;br /&gt;
 set label 2 &amp;quot;(a) n=1&amp;quot;&lt;br /&gt;
 set lmargin at screen marL&lt;br /&gt;
 set rmargin at screen marL + 1*plotX&lt;br /&gt;
 set tmargin at screen 1.0-marT&lt;br /&gt;
 set bmargin at screen 1.0-marT-1*plotY&lt;br /&gt;
 &lt;br /&gt;
 unset xlabel; set xtics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset ylabel; set ytics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset x2label; set x2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset y2label; set y2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set ytics format &amp;quot;%g&amp;quot; # y Tics on&lt;br /&gt;
 &lt;br /&gt;
 set key on&lt;br /&gt;
 plot sin(x) t &amp;quot;sin(n x)&amp;quot;, cos(x) t &amp;quot;cos(n x)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # (b)&lt;br /&gt;
 set label 2 &amp;quot;(b) n=2&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set lmargin at screen marL + 1*plotX&lt;br /&gt;
 set rmargin at screen marL + 2*plotX&lt;br /&gt;
 set tmargin at screen 1.0-marT&lt;br /&gt;
 set bmargin at screen 1.0-marT-plotY&lt;br /&gt;
 &lt;br /&gt;
 unset xlabel; set xtics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset ylabel; set ytics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset x2label; set x2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset y2label; set y2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set key off&lt;br /&gt;
 plot sin(2*x), cos(2*x)&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # (c)&lt;br /&gt;
 set label 2 &amp;quot;(c) n=3&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set lmargin at screen marL&lt;br /&gt;
 set rmargin at screen marL + 1*plotX&lt;br /&gt;
 set tmargin at screen 1.0-marT-1*plotY&lt;br /&gt;
 set bmargin at screen 1.0-marT-2*plotY&lt;br /&gt;
 &lt;br /&gt;
 unset xlabel; set xtics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset ylabel; set ytics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset x2label; set x2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset y2label; set y2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set ytics add (&amp;quot;&amp;quot; 1.2) # prevent overwriting of label of (a)&lt;br /&gt;
 &lt;br /&gt;
 # Axis Labels&lt;br /&gt;
 set xlabel &amp;quot;X-LABEL&amp;quot;  offset 13.5 , 0&lt;br /&gt;
 set ylabel &amp;quot;Y-LABEL&amp;quot;  offset  0   , 5&lt;br /&gt;
 &lt;br /&gt;
 set xtics format &amp;quot;%g&amp;quot; # x Tics on&lt;br /&gt;
 set ytics format &amp;quot;%g&amp;quot; # y Tics on&lt;br /&gt;
 &lt;br /&gt;
 plot sin(3*x), cos(3*x)&lt;br /&gt;
 unset xlabel ; unset ylabel&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # (d)&lt;br /&gt;
 set label 2 &amp;quot;(d) n=4&amp;quot;&lt;br /&gt;
 set lmargin at screen marL + 1*plotX&lt;br /&gt;
 set rmargin at screen marL + 2*plotX&lt;br /&gt;
 set tmargin at screen 1.0-marT-1*plotY&lt;br /&gt;
 set bmargin at screen 1.0-marT-2*plotY&lt;br /&gt;
 &lt;br /&gt;
 unset xlabel; set xtics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset ylabel; set ytics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset x2label; set x2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 unset y2label; set y2tics format &amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set xtics format &amp;quot;%g&amp;quot; # x Tics on&lt;br /&gt;
 set xtics add (&amp;quot;&amp;quot; -10) # prevent overwriting of label of (c)&lt;br /&gt;
 &lt;br /&gt;
 set key on&lt;br /&gt;
 plot sin(4*x) t &amp;quot;sin(n x)&amp;quot;, cos(4*x) t &amp;quot;cos(n x)&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 unset multiplot&lt;br /&gt;
 unset output&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # trim eps&lt;br /&gt;
 s = &amp;#039;epstool --copy --quiet --bbox &amp;quot;plot.gpeps&amp;quot; &amp;quot;plot.eps&amp;quot;&amp;#039; ; system (s) ; system &amp;quot;rm plot.gpeps&amp;quot;&lt;br /&gt;
 # eps -&amp;gt; pdf&lt;br /&gt;
 if (outtype eq &amp;quot;pdf&amp;quot;) s = &amp;#039;epstopdf --embed &amp;quot;plot.eps&amp;quot;&amp;#039; ; system (s) #embed=embed fonts&lt;br /&gt;
 # eps -&amp;gt; png&lt;br /&gt;
 if (outtype eq &amp;quot;png-solid&amp;quot;) s = &amp;#039;convert -density 150 -trim +repage &amp;quot;plot.gpeps&amp;quot; -background white -flatten +matte -type Palette &amp;quot;plot.png&amp;quot;&amp;#039; ; system (s)&lt;br /&gt;
 if (outtype eq &amp;quot;png-trans&amp;quot;) s = &amp;#039;convert -density 150 -trim +repage &amp;quot;plot.gpeps&amp;quot; -transparent white &amp;quot;plot.png&amp;quot;&amp;#039; ; system (s)&lt;br /&gt;
 # remove eps&lt;br /&gt;
 system &amp;quot;rm plot.eps&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Multiplot using macros and Xmargin at screen====&lt;br /&gt;
 #!/usr/bin/gnuplot&lt;br /&gt;
 # Demonstration of a common use scenario of the multiplot environment. AUTHOR: Hagen Wierstorf&lt;br /&gt;
 # http://www.gnuplotting.org/multiplot-placing-graphs-next-to-each-other/&lt;br /&gt;
 &lt;br /&gt;
 # Functions (1/0 means not defined)&lt;br /&gt;
 a = 0.9&lt;br /&gt;
 f(x) = abs(x)&amp;lt;2*pi ? a*sin(x)           : 1/0&lt;br /&gt;
 g(x) = abs(x)&amp;lt;2*pi ? a*sin(x+pi/2)      : 1/0&lt;br /&gt;
 h(x) = abs(x)&amp;lt;2*pi ? a*sin(x+pi)        : 1/0&lt;br /&gt;
 k(x) = abs(x)&amp;lt;2*pi ? a*sin(x+3.0/2*pi)  : 1/0&lt;br /&gt;
 &lt;br /&gt;
 unset key&lt;br /&gt;
 #set tics scale 0.5&lt;br /&gt;
 set ytics 1&lt;br /&gt;
 set xrange [-2.5*pi:2.5*pi]&lt;br /&gt;
 set yrange [-1.5:1.5]&lt;br /&gt;
 &lt;br /&gt;
 # MACROS&lt;br /&gt;
 set macros  # Enable the use of macros&lt;br /&gt;
 # x- and ytics for each row resp. column&lt;br /&gt;
 NOXTICS = &amp;quot;set xtics (&amp;#039;&amp;#039; -2*pi, &amp;#039;&amp;#039; -pi,&amp;#039;&amp;#039; 0, &amp;#039;&amp;#039; pi, &amp;#039;&amp;#039; 2*pi); \&lt;br /&gt;
           unset xlabel&amp;quot;&lt;br /&gt;
 XTICS = &amp;quot;set xtics (&amp;#039;-2Pi&amp;#039; -2*pi, &amp;#039;-Pi&amp;#039; -pi,&amp;#039;0&amp;#039; 0, &amp;#039;Pi&amp;#039; pi, &amp;#039;2Pi&amp;#039; 2*pi);\&lt;br /&gt;
           set xlabel &amp;#039;x&amp;#039;&amp;quot;&lt;br /&gt;
 NOYTICS = &amp;quot;set format y &amp;#039;&amp;#039;; unset ylabel&amp;quot;&lt;br /&gt;
 YTICS = &amp;quot;set format y &amp;#039;%.0f&amp;#039;; set ylabel &amp;#039;y&amp;#039;&amp;quot;&lt;br /&gt;
 # Margins for each row resp. column&lt;br /&gt;
 TMARGIN = &amp;quot;set tmargin at screen 0.98; set bmargin at screen 0.58&amp;quot;&lt;br /&gt;
 BMARGIN = &amp;quot;set tmargin at screen 0.58; set bmargin at screen 0.18&amp;quot;&lt;br /&gt;
 LMARGIN = &amp;quot;set lmargin at screen 0.13; set rmargin at screen 0.56&amp;quot;&lt;br /&gt;
 RMARGIN = &amp;quot;set lmargin at screen 0.56; set rmargin at screen 0.99&amp;quot;&lt;br /&gt;
 # Placement of the a,b,c,d labels in the graphs&lt;br /&gt;
 POS = &amp;quot;at graph 0.92,0.9 font &amp;#039;,18&amp;#039;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 ### Start multiplot (2x2 layout)&lt;br /&gt;
 set multiplot layout 2,2 rowsfirst&lt;br /&gt;
 # --- GRAPH a&lt;br /&gt;
 @TMARGIN; @LMARGIN&lt;br /&gt;
 @NOXTICS; @YTICS&lt;br /&gt;
 set label 1 &amp;#039;a&amp;#039; @POS&lt;br /&gt;
 plot f(x) with lines ls 1&lt;br /&gt;
 # --- GRAPH b&lt;br /&gt;
 @TMARGIN; @RMARGIN&lt;br /&gt;
 @NOXTICS; @NOYTICS&lt;br /&gt;
 set label 1 &amp;#039;b&amp;#039; @POS&lt;br /&gt;
 plot g(x) with lines ls 1&lt;br /&gt;
 # --- GRAPH c&lt;br /&gt;
 @BMARGIN; @LMARGIN&lt;br /&gt;
 @XTICS; @YTICS&lt;br /&gt;
 set label 1 &amp;#039;c&amp;#039; @POS&lt;br /&gt;
 plot h(x) with lines ls 1&lt;br /&gt;
 # --- GRAPH d&lt;br /&gt;
 @BMARGIN; @RMARGIN&lt;br /&gt;
 @XTICS; @NOYTICS&lt;br /&gt;
 set label 1 &amp;#039;d&amp;#039; @POS&lt;br /&gt;
 plot k(x) with lines ls 1&lt;br /&gt;
 unset multiplot&lt;br /&gt;
&lt;br /&gt;
====Insets====&lt;br /&gt;
 # plot 2(inset)&lt;br /&gt;
 set size 0.2,0.4&lt;br /&gt;
 set origin 0.2,0.5&lt;br /&gt;
 clear # !!! clears the plot area from grid lines etc&lt;br /&gt;
 # draw frame&lt;br /&gt;
 set object 1 rect from screen 0.2, screen 0.5 to screen 0.5, screen 0.9 back behind&lt;br /&gt;
 set object 1 rect fc rgb &amp;quot;white&amp;quot; fillstyle solid 1.0&lt;br /&gt;
 set lmargin 6; set bmargin 1.5; set rmargin 0;set tmargin 0&lt;br /&gt;
 unset key&lt;br /&gt;
 unset xlabel ;  unset ylabel ;  unset y2label&lt;br /&gt;
&lt;br /&gt;
====My Plot Template====&lt;br /&gt;
allowing to choose between Terminal PNG or MetaPost&lt;br /&gt;
&lt;br /&gt;
Main file &amp;#039;&amp;#039;&amp;#039;plot.gp&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 #!/usr/bin/gnuplot&lt;br /&gt;
 load &amp;quot;/MessSoftware/A_gnuplot-header.gp&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 term = &amp;quot;png&amp;quot;&lt;br /&gt;
 term = &amp;quot;mp&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 plotfolder = &amp;quot;png_XYZ&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
 data1 = &amp;quot;data/Eins.dat&amp;quot;&lt;br /&gt;
 data2 = &amp;quot;data/Zwei.dat&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 set style data linespoints&lt;br /&gt;
 set style increment user&lt;br /&gt;
 set style line  1 linetype 1 lw 2 ps 2&lt;br /&gt;
 set style line  2 linetype 2 lw 2 ps 2&lt;br /&gt;
 &lt;br /&gt;
 if (term eq &amp;quot;mp&amp;quot;  ) set terminal mp color solid latex psnfss prologues 2&lt;br /&gt;
 if (term eq &amp;quot;png&amp;quot; ) set terminal png enhanced giant size 1024,768&lt;br /&gt;
 &lt;br /&gt;
 data = data1&lt;br /&gt;
 load &amp;quot;plot_c_vs_d1.gp&amp;quot; # in here is the plot function&lt;br /&gt;
 &lt;br /&gt;
 data = data2&lt;br /&gt;
 load &amp;quot;plot_c_vs_d1.gp&amp;quot; # again...&lt;br /&gt;
 &lt;br /&gt;
 if (term eq &amp;quot;mp&amp;quot;  ) s = &amp;quot;perl convert.pl &amp;quot; . plotfolder ; system (s)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
plot file &amp;#039;&amp;#039;&amp;#039;plot1.gp&amp;#039;&amp;#039;&amp;#039;, executed for each data set&lt;br /&gt;
 f(x) = m*x+b&lt;br /&gt;
 fit f(x) data using (log($1)):(log($2)) via m,b&lt;br /&gt;
 fe(x) = x**m * exp(b)&lt;br /&gt;
 set label 1 sprintf(&amp;quot;m=%.2f&amp;quot;,m) at graph 0.05, graph 0.75&lt;br /&gt;
 set output plotfolder . &amp;quot;/&amp;quot; . &amp;quot;.&amp;quot; . term&lt;br /&gt;
 plot \&lt;br /&gt;
   data u ($1):($2) notitle \&lt;br /&gt;
 , fe(x) title &amp;quot;fit&amp;quot; w lines lw 1&lt;br /&gt;
 unset output ; unset label 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
perl script &amp;#039;&amp;#039;&amp;#039;convert.pl&amp;#039;&amp;#039;&amp;#039; for converting .mp to png and .mps&lt;br /&gt;
 #!/usr/bin/perl -w&lt;br /&gt;
 use warnings;use strict;&lt;br /&gt;
 &lt;br /&gt;
 my $del_mps = 1;&lt;br /&gt;
 my $dpi = 222.841; # -&amp;gt; 28cm in ooimpress &lt;br /&gt;
 &lt;br /&gt;
 my $plotdir = &amp;quot;png&amp;quot;;&lt;br /&gt;
 $plotdir = shift if @ARGV;&lt;br /&gt;
 chdir $plotdir or die $!;&lt;br /&gt;
 &lt;br /&gt;
 my @a = &amp;lt;*.mp&amp;gt;;&lt;br /&gt;
 foreach my $f (@a) {&lt;br /&gt;
   print &amp;quot;--&amp;gt;$f\n&amp;quot;;&lt;br /&gt;
   $_ = $f;&lt;br /&gt;
   $f =~ s/ /_/g;&lt;br /&gt;
   `mv &amp;quot;$_&amp;quot; &amp;quot;$f&amp;quot;` unless ($_ eq $f);&lt;br /&gt;
   my $fname = $f;  &lt;br /&gt;
   $fname =~ s/\.[^\.]*?$//; # remove ext&lt;br /&gt;
   print system(&amp;quot;mpost -tex=latex &amp;#039;$fname.mp&amp;#039;&amp;quot;);&lt;br /&gt;
   print &amp;quot;\n&amp;quot;;&lt;br /&gt;
   my @b = grep {m/\.[\d]+$/}  grep {-f $_} &amp;lt;$fname.*&amp;gt;;&lt;br /&gt;
   $f = $b[0];&lt;br /&gt;
   print `mv &amp;quot;$f&amp;quot; &amp;quot;$fname.mps&amp;quot;`;&lt;br /&gt;
   print `convert -density $dpi &amp;quot;$fname.mps&amp;quot; &amp;quot;$fname.png&amp;quot;`;&lt;br /&gt;
   print `rm &amp;quot;$fname.mps&amp;quot;` if $del_mps;&lt;br /&gt;
   unlink ( split &amp;quot; &amp;quot;, &amp;quot;$fname.eps $fname.mp $fname.mpx $fname.log&amp;quot;);&lt;br /&gt;
   print &amp;quot;\n&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 $_ = &amp;quot;mpxerr.tex&amp;quot;; unlink $_ if -f $_;&lt;br /&gt;
&lt;br /&gt;
====Perl: plotAll.pl====&lt;br /&gt;
Perl script for generating a plotAll.gp file for all files matching */*.log. In plotAll.gp a file named plot1.gp is loaded for each file, which contains the gnuplot commands.&lt;br /&gt;
&lt;br /&gt;
 use strict; use warnings;&lt;br /&gt;
 #use v5.10;    # say&lt;br /&gt;
 #use Data::Dumper;&lt;br /&gt;
 #my $pathToGnuplot = &amp;#039;&amp;quot;C:\Program Files (x86)\gnuplot\bin\gnuplot.exe&amp;quot;&amp;#039;; &lt;br /&gt;
 my $gpoutfile = &amp;quot;plotAll.gp&amp;quot;;&lt;br /&gt;
 my $gpplot1 = &amp;quot;plot1.gp&amp;quot;;&lt;br /&gt;
 my @Files = &amp;lt;*/*.log&amp;gt;; #print Dumper @Files;&lt;br /&gt;
 open (my $fh, &amp;quot;&amp;gt;&amp;quot;, $gpoutfile) or die $!;&lt;br /&gt;
 print $fh &amp;quot;print \&amp;quot;Gnuplot Start\&amp;quot;\n&amp;quot;;&lt;br /&gt;
 foreach my $file (@Files){&lt;br /&gt;
   print $fh &amp;quot;data = \&amp;quot;$file\&amp;quot; ; load \&amp;quot;$gpplot1\&amp;quot; \n&amp;quot;;&lt;br /&gt;
 }&lt;br /&gt;
 close $fh;&lt;br /&gt;
 #$_ = &amp;quot;$pathToGnuplot $gpoutfile&amp;quot;;&lt;br /&gt;
 $_ = &amp;quot;$gpoutfile&amp;quot;;&lt;br /&gt;
 system($_);&lt;br /&gt;
 unlink $gpoutfile;&lt;br /&gt;
&lt;br /&gt;
====Filled Curves====&lt;br /&gt;
 set style fill solid 1.0 noborder&lt;br /&gt;
 plot [:] [*:*] \&lt;br /&gt;
 ,f1(x) with filledcurve y1=0 lc rgb &amp;quot;gray80&amp;quot; \&lt;br /&gt;
  f2(x) with filledcurve y1=0 lc rgb &amp;quot;gray60&amp;quot; \&lt;br /&gt;
 ,f1(x) ls 2 \&lt;br /&gt;
 ,f2(x) ls 3&lt;br /&gt;
 # first the areas, than the lines in the right linecolor&lt;br /&gt;
&lt;br /&gt;
=====Filled Area between 2 Curves=====&lt;br /&gt;
 f1(x) = sin(x)&lt;br /&gt;
 f2(x) = x+1&lt;br /&gt;
 set style fill solid 0.4 border&lt;br /&gt;
 plot \&lt;br /&gt;
 &amp;#039;+&amp;#039; using 1:(f1($1)):(f2($1)) with filledcurve&lt;br /&gt;
 # &amp;#039;+&amp;#039; allows treatment of functions as data&lt;br /&gt;
&lt;br /&gt;
=====Color-map of 3d data=====&lt;br /&gt;
 set palette defined (0 &amp;quot;white&amp;quot;, 1 &amp;quot;blue&amp;quot;, 2000 &amp;quot;red&amp;quot;)&lt;br /&gt;
 set logscale cb&lt;br /&gt;
 set view map&lt;br /&gt;
 splot data u 2:1:3 with image&lt;/div&gt;</summary>
		<author><name>Torben</name></author>
	</entry>
</feed>