JGNUplot

A graphical user interface for gnuplot.
SourceForge.net Logo

What is JGNUplot?

JGNUplot is a graphical user interface for gnuplot. So why would somebody want to have a user interface for something which is so great because it has none?

Gnuplot is a fairly mighty plotting software. But when one has to deal with a large number of datasets, the typing of the plot commands over the keyboard can become fairly tedious. Sometimes the fields in the datasets have to be combined using more complex formula. In such cases you end up with very complicated plot commands.

Sometimes one may want to quickly add or delete a certain dataset from the plot. Or maybe pick a different color or linestyle.

JGNUplot is a JAVA written interface which uses gnuplot as plotting engine.

JGNUplot allows to define a pre-plot command. This can either be any system function like sort, grep, awt, sed or a program provided by the user. This allows to pre-process the datafiles before thy are plotted. For example one might want to sort them or to delete blank lines.

Currently the only supported operating system is Linux.

JGNUplot is distributed under the GPL license.

Download

JGNUplot can be downloaded from sourceforge.

Documentation

Prerequisites

You need to have gnuplot installed. See http://www.gnuplot.info/. It is recommended to install version 4.1 to get all features. The executeable must be in your path to allow JGNUplot to find it.

JGP was compiled for JAVA 5.0. You will need a proper runtime or jdk. See http://java.sun.com/. JGP does make use of JGP features, don't try to compile it with an older JAVA version.

Installation

Unzip the zip archive into a directory of you choice. Make the file jgp executeable

# chmod +x jgp

and execute it.
Do not background the process. JGP was found to crash if backgrounded. You may also start JGP with
# java -cp ./classes jgp.gui.JGP

Compiling

The source is provided along the JAVA binaries. To compile JGP make the file makeJGNUplot executeable

# chmod +x makeJGNUplot

and execute it or run
# javac -d classes ./src/jgp/*.java ./src/jgp/gui/*.java

Quickstart

Plotting a function

Start JGNUplot using the script

# ./jgp

(no, please don't background the process).

Click on Add.

Select function, replace 1:2 in the function field by a function like sin(x).

Enter a title and click Ok.

Click on Plot, a sine should appear on your screen. If not, check that gnuplot is installed and that it is in your path.

Plotting a datafile

Create a ASCII data file, use a text editor, create two colums of data separated by ","'s.

Click on Add.

Make sure that file is selected, enter the path to the file or use the file browser to search for it (button next to the file textfield).

Enter a the datastring 1:2 into the datastring textfield (should actually be there already.

Enter a title and click Ok.

Click on Plot, and the datafile should appear on your screen.

Next steps...

Click on the preview plotsting button. It lets you examine the plotstring which is passed to gnuplot. It might be a good idea to try to became familiar with the commands in the plot string, i.e. read the gnuplot manual or start gnuplot and use the help command.

Features

Preprocessing your datafiles

JGNUplot can run an arbitrary program on your datafile before plotting it:
Click on Add, check the preprocess through external program feature. Here you might enter something as simple as a sort command

sort $if > $of

or a grep to remove empty lines
cat $if | grep -v "^$" $if > $of

where JGNUplot will replace the variable $if with your data filename defined above and $of with the name of a temporary file. Of course you can enter any sophisticated awk command here or just preprocess the data though are program you wrote yourself.

GNUplot and String variables

Normal gnuplot variables can be defined, but also string replace variables:
Check the variables section.
Here you have the choice between two types of variables. GNUPLOT variables are actual variables within gnuplot. The will appear in the plotsting as:

set variable_name = value

The second type is a STRING variable. If you assign the name variable_name to a string variable, JGNUplot will first generate a plotstring and the search for the occurrence of any "$variable_name" substring in the plotstring. You may therefore use $variable_name at ANY other place like for additional style definitions etc.

Additional plot commands

By no means JGNUplot tried to provide GUI access to all gnuplot features, but you can define additional plot commands. This allows access to most gnuplot commands:
Have a look at the Add(itional) plot commands section. If missed some feature in JGNUplot. Its very likely that may be able to fix that here. For example, JGNUplot does not allow to set the location of the legend yet. Solution: Enter a

set key X,Y

in the Add(itional) plot commands field, where X,Y are the desired coordinates for the legend.

Screenshots

Screenshots can be found on sourceforge.

Contact

Please use the forum or the tracker on sourceforge for contact.
 
Last edited: September 9th, 2006
Author: Maximilian Fabricius