What is xfim?

xfim is a simple program to display two-dimensional numerical data, either to an X display or to a PPM file. Its companion program is xgr, which displays one-dimensional numerical data.


Where is xfim?

The source directory is math.arizona.edu/~kerl/src/x11. A tar file is located at math.arizona.edu/~kerl/src/x11.tgz.

Why xfim?

xfim has far fewer features than, say, Matlab's plotter. It is nothing more than a quick hack. However, it has the following benefits:

File formats

xfim takes a real or complex matrix as input, mapping matrix values to grayscale values. Data files are single-precision floating-point binary, in network (big-endian) byte order. Conversion to/from ASCII should be done using a separate program.

Command-line arguments
Usage: xfim [options] {file num rows} {file num cols} {input file name}
  --help:  Print this message.
  -r:      Input is binary real.
  -lin:    Use linear remap
  -log:    Use log remap
  -quad {a}: Use quadratic remap with midpoint a, 0-1
  -mag:    Binary complex input, plotting magnitude
  -maglog: Binary complex input, plotting log of magnitude
  -phz:    Binary complex input, plotting phase
  -re:     binary complex input, plotting real part
  -im:     binary complex input, plotting imag. part
  -p {n}:  Pixels per sample.  E.g. -p 3 to magnify 3x
  -nc {n}: Specify # grey shades, e.g. for old video cards
  -min:    Manually specify remap min
  -max:    Manually specify remap min
  -ppm {f.ppm}: Write to f.ppm instead of X display


This example uses KML programs to generate and transform data.

spikegen2d -r 64 64 a 3:5:1 7:8:1 10:11:1
fft2d -ri 64 64 a b
xfim -r  -p 3 64 64 a &
xfim -re -p 3 64 64 b &


I have not modified xfim recently.

xfim handles X events very naively. In particular, it handles each resize event to completion, in sequence, even if several more resize events are pending. This makes for slow redraws, particuarly when communicating with an X server over a slow network. This effect worsens as the amount of data plotted increases.


xfim is released under the terms of the GNU General Public License (GPL). Please see the file COPYING for more details. Also please visit www.gnu.org.

xfim has been run on Linux 2.4 and Solaris 5.8, compiled by GCC 3.2.2 and above. It should run on any Unix with X11 and a GCC.

Contact information

John Kerl
kerl at math dot arizona dot edu

Last updated: 2005-07-26