What is GnuPlot Stream?

GnuPlot Stream (gps) is wonderful script written by Simone Zuccher.

Why to use it?

If you use Octave, and you would like to produce high quality figures with legends written in LaTeX, gps is right for you. It is Octave script used for plotting.

Octave itself can generate figures by means of gnuplot but possibilities are limited. You can also export data to temporary file, and use gnuplot externally to get the desired figure and use all capabilities of gnuplot, but this method is unnecessarily complicated. You can use gps to do all this things directly in the octave script. It is sort of Octave-to-gnuplot interface.

Gps creates hidden temporary files with plot data, sets gnuplot's pslatex terminal, plots the figure, and runs latex to get the final figure with all latex specialties in legends you can think off.

Problem of gps

The only problem of GnuPlot Stream was it didn't allow to set dimensions of the paper, the font size and some other details. Therefore I changed it a little.

My version of gps

I added the possibility to call the gps in the following way:

gps("psp", root-name, plot settings)

The first argument is always "psp", the second one is the root of figure filename without extension (the extension ".ps" is added automatically by gps). Third argument is pslatex gnuplot terminal settings.

Examples:
Following command creates file fig5.ps, standard gnuplot settings, width of the image is 14 cm, height 5 cm, fontsize 6.

gps("psp","fig5","size 14cm,5cm 6")

To create file fig6.ps with oldstyle setting of gnuplot, pslatex terminal, use:
gps("psp","fig6","oldstyle")

Example script how to use my version of gps

This script produce following graph (.pdf or .png version):
GPS example
Note the mathematics in labels (e.g. multiple superscripts) and width/height ratio.

Download

The improved GnuPlot Stream script.
The example.

Remark

Gnuplot's pslatex terminal gives following possibilities:
(rotate | norotate)
(oldstyle | newstyle)
(auxfile | noauxfile)
(level1 | leveldefault)
(color | colour | monochrome)
(solid | dashed)
(dashlength | dl <DL>)
(linewidth | lw <LW>)
(rounded | butt)
(clip | noclip)
(palfuncparam <samples>(,<maxdeviation>))
(size <XX>(unit),<YY>(unit))
(<font_size>)