Comparison of linux scientific graphing programs

For scientific graphing and plotting in Linux, the following features are minimal requirements:

  1. High quality PostScript output.
  2. Ability to draw spline curves between data points in X-Y plots without having to create an artificial data set.
  3. Flexible creation of bar graphs with error bars. It doesn't have to be so easy that the Scientific Director could create a graph (no software is that easy), but it shouldn't take two hours to create one either. It shouldn't require kludges like creating an artificial data set to describe all four sides of each bar.
  4. Ability to compile from source code. This is important in Linux, where changes are often made that render all existing software inoperative. If the software is from some company that doesn't release their source code, you could discover one day that all your graphs saved in their proprietary file format are suddenly unreadable.
  5. Ability to be installed without a monumental struggle.
  6. Ability to create multiple graphs on a page.
Although most of the software packages I tested created nice graphs, all of them had a few small problems.

xmgr

Summary

xmgr is a Motif-based 2D plotting program. It's an older version of xmgrace; development of xmgr stopped several years ago. Completely interactive, with menus and dialog boxes that are automatically updated when a parameter is changed. Even though it's older, xmgr is still preferable to xmgrace for point-to-point graphs because of its more rational menu layout. Most options, such as tic mark length, can be adjusted by typing the desired length. Convenient to use and gives nice results, but doesn't handle bar graphs very well. Has advanced math features like spline fitting and non-linear regression with user-defined equations. Although it gives the calculated parameters, the nonlinear curve fitting is not very useful because it the error of estimate is not given. It also can't plot statistical results (such as confidence curves). Resizing the xmgr window triggers numerous redraw events that tie up the CPU and can take up to half a minute to stop.

Installation

Xmgr no longer compiles in linux without editing the source code.

Edit src/pars.yacc and remove the line containing "LOG2"
configure
make
make install

xmgrace


Summary
A newer version of xmgr with more features and better handling of bar graphs. The menu layout, however, is perverse, and it is sometimes necessary to trick the program into not "helping" you by changing settings seemingly at random while you're creating a graph.

Creating bar graphs that contain error bars is a PITA, but possible; however, there's no way to specify different colors for the upper and lower error bar. Thus, if both the bar and error bar are dark, the lower error bar will be invisible. However, you can get around this by plotting the same data set twice in different colors. As with xmgr, only a few primary colors are available. To create a new color, it's necessary to edit the PostScript output. Also, the printed output in xmgrace defaults to thick line widths. This is useful if you intend to photograph your plot or for publication, but for analyzing data thin lines are often better. I had to create a script that automatically resets all the lines to zero width. It is also difficult to control the positioning of the graph on the page. Luckily, the PostScript output is conveniently organized, which makes it easy to edit the PostScript to get the graph positioned correctly.

Although the nonlinear curve fitting gave the calculated parameters, in my tests I had trouble getting it to give an estimate of the error. Upon inspection of the source code, I found that the error is not printed if any of the data points is zero. However, nonlinear curve fitting still seems to need more development.

Coplot


Summary
Java-based drawing and graph plotting software. Commercial software with a 30-day free trial. Like xmgr and xmgrace, you can enter parameters like tic mark length manually in a text widget; but in coplot you can also resize things interactively by clicking on pushbuttons. It's easy to create multiple graphs on a page and edit them simultaneously. Actually, it's too easy. I did this accidentally while testing coplot.

However, no source code is available, which means if, heaven forbid, the company goes out of business, the program is likely to become nonfunctional the next time you upgrade your system.

URL www.cohort.com

Installation

Installation was not so easy, and took over an hour. Most of this was due to troubles with SuSE's Yast installer not being able to read SuSE's CD.

  1. Install IBM Java runtime from Suse CD (The JRE from the coplot website doesn't work in SuSE).
  2. Add /usr/lib/IBMJava2-1.3.0 to PATH in /etc/profile
  3. chmod a+x cp6204L.bin
  4. su
  5. cp6204L.bin to install (install in /usr/local/bin/cohort6)
  6. Add /usr/local/bin/cohort6 to PATH in /etc/profile
      cd /usr/local/bin/cohort6
      chmod a+x CoPlot
      chmod a+x CoStat
      chmod a+x CoText
      chmod a+x smanual 
      chmod a+x pmanual
      chmod a+x cocalc
      chmod a+x cocalc2
  7. CoPlot and coplot are both scripts that are supposed to call java with the appropriate arguments. They need to be edited to work with the IBM JRE 1.3. Coplot's web page recommends uninstalling JRE 1.4 if it exists. This could be a major inconvenience for some users.
  8. Change /usr/local/bin/cohort6/coplot from:
      java -Xmx512m -Xincgc -cp cohort.jar \
    com.cohort.CoPlot $1 $2 $3 $4
    to
       "/usr/lib/IBMJava2-1.3.0/jre/bin/java" -Xmx512m \
     -cp cohort.jar com.cohort.CoPlot
    the quotation marks seem to be necessary.
  9. Several windows should pop up.
    Your Name: Trial (whatever user name it says on the web page)
    Registration Number (CoPlot): (whatever password it says on the web page)
    CoStat Registration Number:
    Click Am I registered
  10. CoPlot is graphical and interactive, with numerous dialog boxes and menus. Uses java runtime environment, which means it is relatively slow. If the wrong RTE is used, it doesn't display properly. Has nonlinear regression, logarithmic axes, bar charts, etc. Some of the Java dialog boxes didn't display correctly until the window was manually resized. Once you get used to the nonintuitive way of selecting objects, it is powerful, but there is no source code. The software is still a little unstable. Save your work frequently.

Biggles


Summary
Non-interactive, script-based. Uses Python. The goal of biggles, according to its documentation, is to produce a plotting package that isn't deeply frustrating. This is a tall order.

Installation

  1. install python and python-numeric.
  2. gmake
  3. gmake install

To use biggles, you have to create a script. For example,

	#!/usr/bin/env python

	import biggles

	x = [1, 2, 3, 4, 5]
	y = [5, 4, 3, 2, 1]

	p = biggles.FramedPlot()
	p.add( biggles.Curve(x, y) )
	p.show()

You then make the script executable and execute it. It produces output very similar in appearance to gnuplot and calls xplot to display the result. To create a PostScript output, you add a line like:

        p.write_eps( "example2.eps" )

Useful for rapidly plotting functions, like Maple or Mathematica.

GRI

Summary
A graphical programming language for producing simple graphs. Has an autoconf script to make compilation easier. Written in C++. Gri's philosophy is similar to TeX, where you write a description of the graph, compile it, and then display the output. This doesn't mean that it produces LaTeX output, which it doesn't; but the TeX philosophy of making things easy for the programmer should eventually mean more and better software becoming available in the future.

Users would be justified in learning a new language to create graphs if the language were powerful enough to compensate for the extra work. Unfortunately, the language of GRI is still a bit limited. It only does a few basic types of graphs (e.g., no bar graphs, and no error bars). Extra features can be added, however, due to its programmability. By adding a few loops and a dozen or so commands, GRI can create a bar graph or pie chart. However, the complexity of doing so makes it unlikely that many people will use this software to create complex graphs. After all, they could just as easily learn a more powerful language like PostScript or LaTeX, and create the graphs manually. It's hoped that this program will continue to grow when the author discovers that some scientists do, in fact, need to create pie charts on occasion (although we hate to admit it).

Installation

  configure
  make
  make install

Compiled without incident.

Usage

Create a file called example1.gri containing four commands:

   open example1.dat               # Open the data file
   read columns x y                # Read (x,y)
   draw curve                      # Draw data curve
   draw title "Example 1"          # A title for plot

  gri example1.gri

automatically creates PostScript output of a point-to-point graph.

RLPlot

Summary
Qt-based software. Unable to compile.

Installation

There is no autoconf script. If your libraries are somewhere it doesn't expect, RLPlot won't compile.

  1. make -e didn't work. Find location of Qt by typing locate qapplication.h. It was in /usr/lib/qt-3.0.3.
  2. Edit Makefile to read:
    QTDIR = /usr/lib/qt-3.0.3
    or
    QTDIR = /usr/lib/qt3
    If you change this line, run make clean then make -e.
  3. Add /usr/lib/qt3/lib to /etc/ld.so.conf and type ldconfig
  4. Compilation bombed out with undefined references
     QT_Spec.cpp:1312: no matching function for call\
    to `QMenuBar::setItemVisible (int, bool)'

Could not get it to compile.

Scigraphica

Summary
Only available as rpms. Unable to install.

Source http://scigraphica.sourceforge.net/
http://sourceforge.net/projects/scigraphica/

Installation
Since it's an RPM, all you can do is type 'rpm -i' and cross your fingers (in that order, otherwise you'll probably make typing errors).

  rpm -i scigraphica-0.8.0-1suse80.i386.rpm
  error: failed dependencies:
   gtk+extra >= 0.99.15 is needed by scigraphica-0.8.0-1suse80
   http://gtkextra.sourceforge.net
   configure
   make 
   make install
   add /usr/local/lib to /etc/ld.so.conf
   ldconfig
  If you don't have gtk+, it is available from
   http://magnet.fsu.edu/~feiguin/gtk/download.html
   (this site was down when I tested it)
  python-numeric is needed by scigraphica-0.8.0-1suse80
   (from Suse CD)
  python-gtk is needed by scigraphica-0.8.0-1suse80
   (from Suse CD)

After installing gtk+extra 0.99.17, scigraphica still gave the message

  error: failed dependencies:
  gtk+extra >= 0.99.15 is needed by scigraphica-0.8.0-1suse80
  libgtkextra-0.99.so.17 is needed by scigraphica-0.8.0-1suse80

rpm -ivv showed that it found libgtkextra-0.99.so.17, but it didn't like it for some reason. The rpm version wouldn't install; reason unknown.

The same situation occurred with the source rpm version. The configure script bombed out with

  checking for tgoto in -ltermcap... no
  configure: error: Termcap not found

Even though libtermcap 2.0.8 was already present on my system, I downloaded and installed the source rpm for libtermcap 2.0.8-4 anyway, from http://sparemint.atariforge.net/sparemint/html/packages/libtermcap.html to see what would happen.

  rpm --rebuild libtermcap-2.0.8-4.src.rpm
  In file included from tparam.c:34:
  /usr/include/string.h:242: parse error before `('
  /usr/include/string.h:242: warning: conflicting \
  types for built-in function `memcpy'
  /usr/include/string.h:242: parse error before `__const'
  make: *** [tparam.o] Error 1
  Bad exit status from /var/tmp/rpm-tmp.64115 (%build)

The problem was in tparam.c. Removed lines 27-30 from the source code

  cd /usr/src/packages/SOURCES/termcap-2.0.8
  Remove these three lines in tparam.c:
  #if defined(HAVE_STRING_H) || defined(STDC_HEADERS)
  #define bcopy(s, d, n) memcpy ((d), (s), (n))
  #endif

which allowed it to build successfully.

  make
  make install

Then I returned to scigraphica directory. Configure now bombed out in xml-config. Downloaded xml-config from http://sourceforge.net/projects/xmlconfig/. The documentation for xmlconfig said to install 'ant', which was supposed to be included, and type ant in the xmlconfig directory. However, ant was not, in fact, included. Ant is a configuration tool from www.apache.org. Downloaded ant.

To install Ant, choose a directory and copy the distribution file there. This directory will be known as ANT_HOME. Copied the bin directory to /usr/local/bin/.

Changed to xmlconfig directory. Set ANT_HOME by typing export ANT_HOME=/usr/local/bin/

  ant
  Unable to initialize threads: cannot find 
  class java/lang/Thread

  export JAVA_HOME=/usr/lib/IBMJava2-1.3.0
  ant
  Exception in thread "main" java.lang.NoClassDefFoundError: \
  org/apache/tools/ant/launch/Launcher

????
Could not find any file called "Launcher". Decided to wait until more time was available before finishing installation.

JPlot

Summary
Java-based graphing program. Requires Swing and AWT. Unable to install.

Installation

No autoconf script or documentation. Tried "gmake". Gmake bombed out with errors like

   src/AxesPanel.java:32: Package javax.swing not found in import.
   import javax.swing.*;
   src/PrintTextPainter.java:34: Package java.awt.print not found in import.
   import java.awt.print.*;
          ^
   Too many errors.  (The limit on reported errors is 100.)
   101 errors
   make: *** [JPlot] Error 1

Swing and AWT are part of Sun's Java Foundation Classes (JFC) available from http://java.sun.com/products/jfc/index.jsp. After downloading and installing Sun's JFC, rerunning make, it still bombed out with the same errors.

There is undoubtedly some trick to running this software. Hopefully someday the author will clue those of us who are Java-impaired on the correct procedure for installing this software.

Update Compilation instructions are located at http://www.tcptrace.org/jPlot/#Compilation . According to one helpful reader, the "fix up the JAVADIR entry in the makefile" works, as does the "javac jPlot.java" approach.

R

Summary

Although R is widely known as a powerful statistics program, it can also produce graphs.

Installation

See http://carbon/linuxsetup91.html

Plotting simple graphs in R is done interactively through its command-line interface. The following commands create a vector named "y" and produce a crude graph:

  y<-c(1,2,4,5,3,6,7)
  plot(y, type="b")

The graph that is produced is similar in appearance to the default graph produced by gnuplot (see below). The procedure rapidly gets more complicated, requiring many lines of typing, if custom graphs are needed, as is usually the case. Even after reading the book "R Graphics" by P. Murrell, I still find it very difficult to produce nice-looking graphs in R.

Other packages (not tested)

Mathematica A powerful, mathematics-oriented commercial package.

Maple A powerful, mathematics-oriented commercial package.

Matlab A powerful, mathematics-oriented commercial package.

Scilab A free version of Matlab.

Gnuplot The standard plotting program for all Unix-like operating systems. Uses a command language to create plots. Although it is not interactive, the commands can be fed to gnuplot through a FIFO. This allows programmers to easily create front-ends that organize the data, then rapidly create a static or animated plot using gnuplot.

Supermongo http://www.astro.princeton.edu/~rhl/sm/ Similar to GRI. The user enters commands interactively to generate a plot. Contains a simple but complete programming language. Manages error bars, axes, scaling, and statistics. Open source. Costs $300 for a "lifetime site license" for a department or $1500 for a "lifetime site license" for an entire University.


Back