

To produce the standalone figure we have to run more than just the gnuplot command: $ gnuplot introduction.gnu The last value is the font size of the plot, which you don’t need if you want to include the figure in your LaTeX document.
#Set terminal gnuplot code#
Therefore exchange the above code with set terminal epslatex size 3.5, 2.62 standalone color colortext 10 set output 'introduction.tex' If you haven’t any LaTeX document, but want only to produce a figure with LaTeX labels, you can use the standalone mode. But in opposite to the before mentioned terminals the enhanced mode will work fully for the postscript terminal. In addition to that it doubles the given line widths by a factor of 2.īesides, the postscript terminal can’t handle all UTF-8 input characters and we have to use the enhanced mode to produce greek letter etc. It tells the terminal the size in inches of the plot (note that this is the pixel dimension divided by 100) and uses a font size of 20 instead of 10. So if we want to produce the same font and line width dimensions, we have to use this command: set terminal postscript eps size 3.5, 2.62 enhanced color \ In eps mode the whole plot, including the fonts, is reduced to half of the default size. Gnuplot has a postscript terminal that can be used to produce figures in the eps format: set terminal postscript eps enhanced color font 'Helvetica,10' set output 'introduction.eps'īut this creates very tiny fonts, as stated in the documentation:
#Set terminal gnuplot pdf#
I always create my pdf files of the plots from the postscript files, so I will cover only the postscript terminals in this introduction. The png and svg terminals work very well to produce figures to use on the web as you can see on this page, but for scientific papers or other stuff written in LaTeX we would like to have figures in postscript or pdf format. Since we want to create an output file in both cases we have to specify one. But be aware that not all terminals handle the enhanced notation as mentioned in the gnuplot documentation. The enhanced option tells the terminals that they should interpret something like n_1 for us. If we don’t do this, the default value of 640,480 is used. You may also have noticed that we set the size to a given x,y value. It exists also a png terminal, but it produces uglier output and doesn’t use the UTF-8 encoding the cairo library does. You may have noticed that we use the pngcairo terminal. The png and svg terminals produce more or less the same looking output as the wxt terminal, so you only have to replace the line for the wxt terminal with set terminal pngcairo size 350, 262 enhanced font 'Verdana,10' set output 'introduction.png'įor png and with set terminal svg size 350, 262 fname 'Verdana' fsize 10 set output 'introduction.svg'įor svg to produce the same figures I have posted in the last chapter. We already used the wxt terminal there which displays the result on the screen: set terminal wxt size 350, 262 enhanced font 'Verdana,10' persist Therefore we will use the same code as in the previous plot functions chapter.

In this tutorial we will cover the png, svg, postscript and epslatex terminals. Therefore it uses different output terminals that can produce output files or as in the last chapter display the output on your computer screen. Gnuplot gives us the opportunity to produce great looking plots in a lot of different formats.
