The gnuplot script supports the creation of gnuplot graphics from data generated in J.
They work with gnuplot V4.0 or later, and may work with earlier versions.
The original script was contributed by L. Fraser Jackson.
To access:
load 'gnuplot'
When gnuplot is run it creates two files, by default in the ~temp directory:
gnu.plt - plot commands
gnu.dat - data
To display the plot, load gnuplot, then enter, using the correct path name:
load "gnu.plt"
In Windows, you can configure gnuplot to do this automatically.
There are 3 main functions: gplot, gsplot, gset.
[cmd] gplot data
Plots 2D graphics
data is either as an open array for a single plot, or a a boxed list for multiple plots. This has the same format as for Plot.
cmd is options in a list delimited by , in gnuplot format, except that keywords should be spelled in full, e.g. use title not t.
There may be one option list per plot.
The first option list may start with a range indication. The last option list applies thereafter
[cmd] gsplot data
Plots surface graphics. The arguments are as for gplot.
gset optionlist
Set one or more gnuplot options, in gnuplot format. You can set more than one option at a time, by delimiting each option with ; .
In Windows, define GNUPLOTBIN_jgnuplot_ as the name of the gnuplot bin directory. A good place to define this is your startup script.
If defined, then:
In particular, the default style for data in gnuplot is points. To change this to lines, add the following to gnuplot.ini:
set style data lines
Titles default to empty
You can use the double quote character to delimit strings, e.g.
gset 'title "mydata"'
instead of:
gset 'title ''mydata'''
Strings must be delimited, i.e. not:
gset 'title mydata'
You can define GNUPLOTOUT_jgnuplot_ as the output directory for files written by J. By default this is ~temp.
load '~system\examples\graphics\gnuplot\gpdemo.ijs'
gp1'' NB. also gp2, gp3, gp4