Last change

30/6/2021: Updated DrawBivDensity().

GnuDraw is compatible with Ox7, but not parallel-proof: Make sure that graphs are only made in serial parts of your code.

Note that the advanced options of this version of GnuDraw require GnuPlot version 4.22 or later; download this from SourceForge.

Latest version: gnudraw7.zip. See also change log.

GnuDraw

GnuDraw is an Ox package meant for creating GnuPlot graphics.
The interface is completely based on the work of Jurgen Doornik, in his OxDraw package. Likewise, the documentation (see gnudraw.html) is also largely a copy of Jurgen Doornik's oxdraw.html.

GnuPlot can be called automatically from within Ox. Therefore, ShowDrawWindow can be used, displaying graphs on the screen. Under Unix, it is possible using SetDrawWindow to display all graphs in the same drawing window, thus allowing for animated graphs.

The resulting GnuPlot-files are in plain ASCII, and can be adapted to fit final needs.

Output of the GnuPlot files can be of many different types. Included is support for EPS, GIF, PDF, PNG, PS, PSLaTeX, SVG and XFig. There is also an option to save the files in pure GnuPlot format, allowing the user to choose the final output at a later stage.

GnuDraw is also the underlying graphics engine of TSMod, the Time Series Modelling program of James Davidson.

Below are given a short usage instruction, an overview of the extended functionality of GnuDraw, and a logbook of changes at the bottom of this page. Separate pages provide installation instructions and a range of examples of GnuDraw in action. The package contains an elaborate manual in HTML.

Usage

Usage of GnuDraw is intended to be simple. Use it just like you would use the original Ox drawing routines, changing the line
  #include <oxdraw.h>
to
  #include <packages/gnudraw/gnudraw.h>
In the rest of the program, you may choose a different output file format; the GiveWin format is not available, but others come in its place.

If you choose e.g. the EPS output format, creating a graph with

  SaveDrawWindow("example.eps");
then two files are left on your drive: Apart from the example.eps file, a second example.eps.plt file is left, containing the GnuPlot instructions used in creating the graph. This is the file I tend to save, and if necessary adapt afterwards to change the colours at a later stage, add text, and recreate the graphics.

There is also the option to save the graphics only in GnuPlot format, using SaveDrawWindow("example.plb"). In this case, script/batch files can be used to convert the graph to the final format at a later stage. See the explanation for the script/batch files for details.

Extended functionality

First of all, extra output formats are available in GnuDraw. PNG (or GIF, if your GnuPlot installation permits) images can be created for use on web pages, pure PSLaTeX for inclusion in TeX documents. Another output format is the XFig format which can be opened in the XFig graphics editor. The GnuPlot output files are more easily edited (also on Unix) using a simple text-editor to change the final appearance of graphs, without having to resort to re-running the Ox-programs or changing to a Windows computer to run OxMetrics.

The graphs can be displayed on the screen immediately, both on Windows and Unix machines. Under Unix, the option is included to change graphics on the screen, allowing for animated graphs.

Other extensions include:

DrawBivDensity:
Draw a bivariate density plot of a multivariate sample. See the gnubiv1.ox and gnubiv2.ox examples.
DrawDensity, DrawBivDensity:
Allows plotting a weighted sample. See the gnudensis.ox example.
DrawTitle:
Put one title above all the graphing areas. See drawacf.ox for an example.
DrawAcf:
Join the autocorrelation plots in one graphing window. See drawacf.ox for an example.
DrawT, DrawTMatrix:
Now includes the possibility to draw irregularly space time series data. See gnudmy.ox for an example.
DrawAdjust:
Included is an options to plot a line against the second x- or y-axis.
DrawDensity:
The number of bins in a histogram plot can be controlled. Furthermore, a weighted sample can be used as input for DrawDensity, allowing plotting a sample from e.g. the importance sampler. See the gnudensis.ox example.
ShowDrawWindow:
ShowDrawWindow works swiftly on Unix machines and OSX; on Windows machines, displaying a graph also works but less quickly.
SetDrawWindow:
SetDrawWindow on Unix/OSX machines allows using a named graphing window, re-building a graph from Ox such that animated plots are possible. See packages/gnudraw/samples/ar1.ox for an example.

Remarks

The GnuDraw package is under quasi-constant development. Newer versions might appear once in a while. For information, check my homepage.

Please let me know of installation problems, I was not able to check it on many different systems. Also, please drop me a line if you encounter bugs or are missing special functionality.