Gnuplot will dynamically determine if a datafile is ASCII or binary. ASCII data files are discussed in the plot section. For three dimensions, single precision floats are stored as follows:
<ncols> <x0> <x1> <x2> ... <y0> <z0,0> <z0,1> <z0,2> ... <y1> <z1,0> <z1,1> <z1,2> ...
which is converted into triplet:
<x0> <y0> <z0,0> <x0> <y1> <z0,1> <x0> <y2> <z0,2>
<x1> <y0> <z1,0> <x1> <y1> <z1,1> <x1> <y2> <z1,2>
These triplets are then converted into gnuplot iso_curves and then uses gnuplot to do the rest of the plotting.
A collection of matrix and vector manipulation routines (in C) are provided in gnubin.c. The routine to write binary data is
int fwrite_matrix(file,m,nrl,nrl,ncl,nch,row_title,column_title)
An example of using these routines is provided in the file bf_test.c.
The corresponding demo file is demo/binary.dem.