A GAMS Interface for GNUPLOT

NEW Gnuplot 4.1 included!

 

Installation

Syntax

Description

Examples (new Examples, 3D)

Plotting options

Download (old, 4.1)

Command list

Gnuplot homepage

Comments

Credits

* This document is less useful when printed.
 
 

Installation (back to top)

1) Download file.

2) Double click on downloaded file.  Make sure you extract the files to your GAMS system directory. The files “gnupltxy.gms”, “rt1.exe”, and “callgplt.bat” have to be placed in the inclib subdirectory.
 
 

Description (back to top)

Gnupltxy.gms allows users to easily plot data from GAMS runs in GNUPLOT.  It is similar to the GNUPLOT interface created by Thomas Rutherford.  However, Gnupltxy.gms is easily applicable to purely quantitative data. It is flexible in a sense that each data series to be plotted can contain its own x-axis sequence. For example, the data listed below can easily be plotted.
 

 x1 

y1 

x2

y2 

x3

y3 

 

6

  2

2

3

2

2

4

  4

3

5

5

3

3

10

4

7

6

4

1

12

5

8

7

 

 

13

6

 

 

 

 

Gnupltxy.gms is user friendly as only one single line is needed in order to produce a good plot. However, many of the default options can be changed by using option commands as documented below. In addition, one can modify the gnupltxy.gms file for personal needs and preferences. Guidelines of how to do it will be posted in the future but can also be obtained from the authors.

The data to be graphed must be contained in a parameter which has three arguments.  The number of elements in the first argument determines the number of different lines in a plot.  The number of elements in the second argument determines the number of points on a particular line.  The remaining argument must contain at least two set elements of which one represents the x-axis and a second the y-axis coordinates.

Syntax (back to top)

Lines in [] are not necessary. They serve to override default options.

[$setglobal globalvariable value]

[$setglobal globalvariable value]

$libinclude gnupltxy parameter xaxis yaxis

[$setglobal globalvariable value]

[$libinclude gnupltxy parameter xaxis yaxis]


 

Plotting options (back to top)

 

Terminal

Title

Style

Axis

Grid

Border

Box

Size

Font

Data

Key

 

Title 

 

 

 

Variable

 

 

Default value

 

 

 

gp_title

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Style

 

 

 

 

 

 

 

 

 

Variable

 

 

Default value

Color

 

 

gp_color

 

 

color

 

 

 

 

 

 

 

Line style

 

 

gp_style

 

 

lines

 

 

 

gp_line

 

 

solid

 

 

 

 

 

 

 

Line thickness

 

 

gp_lwidth

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Axis

 

 

 

 

 

 

 

 

 

Variable

 

 

Default value

X-axis label

 

 

gp_xlabel

 

 

 

Y-axis label

 

 

gp_ylabel

 

 

 

X2-axis label

 

 

gp_x2label

 

 

 

Y2-axis label

 

 

gp_y2label

 

 

 

 

 

 

 

 

 

 

X2-axis

 

 

gp_x2scale

 

 

not set

Y2-axis

 

 

gp_y2scale

 

 

not set

 

 

 

 

 

 

 

Logarithmic scale

 

 

gp_logscale

 

 

none

 

 

 

 

 

 

Can use: "x", "y", "xy", "none"

Tics location

 

 

gp_tics

 

 

in

X-axis major tics

 

 

gp_xtics

 

 

yes

Y-axis major tics

 

 

gp_ytics

 

 

yes

 

 

 

 

 

 

gnuplot reference

X-axis range

 

 

gp_xrange

 

 

no (gnuplot default is used)

Y-axis range

 

 

gp_yrange

 

 

no (gnuplot default is used)

 

 

 

gp_x2range

 

 

not set

 

 

 

gp_y2range

 

 

not set

 

 

 

 

 

 

 

X-axis label increments

 

 

gp_xinc

 

 

no (gnuplot default is used)

Y-axis label increments

 

 

gp_yinc

 

 

no (gnuplot default is used)

Y-axis label rotation

 

 

gp_yrotate

 

 

yes

 

 

 

 

 

 

 

Grid

 

 

 

 

 

 

 

 

 

Variable

 

 

Default value

Vertical line at y = 0

 

 

gp_xzeroax

 

 

no

Horizontal line at x = 0

 

 

gp_yzeroax

 

 

no

Both x = 0 and y = 0 line

 

 

gp_zeroax

 

 

no

 

 

 

 

 

 

 

Horizontal and vertical grid

 

 

gp_grid

 

 

no

Vertical grid

 

 

gp_xgrid

 

 

no

Horizontal grid

 

 

gp_ygrid

 

 

no

Grid line type

 

 

gp_gline

 

 

4 (if monochrome: 13)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Border, Box

 

 

 

 

 

 

 

 

 

Variable

 

 

Default value

Border

 

 

gp_border

 

 

yes

Border style

 

 

gp_borddim

 

 

all  (default)

Boxwith

 

 

gp_boxwid

 

 

no (gnuplot default)

 

 

 

 

 

 

gnuplot reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Size

 

 

 

 

 

 

Size

 

 

gp_size

 

 

no (gnuplot default)

 

 

 

 

 

 

gnuplot reference

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Font

 

 

 

 

 

 

 

 

 

Variable

 

 

Default value

Name

 

 

gp_font

 

 

Times New Roman

Size

 

 

gp_fntsize

 

 

12

 

 

 

 

 

 

 

Data
 
 

Global variables

Some available values

Description, comments, further reference

gp_supzero

yes

suppress all (0,0) data

 

no

do not suppress all (0,0) data

 

 

default: no

 

 

 

gp_zeroend

no

don't use (0,0) data at the end of a series

 

yes

use (0,0) data at the end of a series

 

 

default: no

 

 

 

 

 

 

 

 

 

Terminal

Note: Most of the below described plotting options work gp_term = windows (default)

Global variables

Some available values

Description, comments, further reference

gp_term

windows

default, shows graph in gnuplot program

 

cgm

computer graphics metafile

 

postscript

postscript

 

aifm

 

 

gif

use only if you have Unisys license.

 

png

 

 

 

gnuplot reference

Color

Global variables

Some available values

Description, comments, further reference

gp_color

color

 

 

monochrome

 

 

 

 

Global and individual line styles

Global variables

Some available values

Description, comments, further reference

gp_style

lines

sets global default line style

 

linespoints

 

 

points

 

 

dots

 

 

boxes

 

 

steps

 

gp_line

solid

only if terminal is set to postscript

 

dashed

only if terminal is set to postscript

gp_l1style

points

sets individual style to first line

 

 

gp_l2style

 

sets individual style to second line

 

 

gp_l15style

 

sets individual style to ninth line

 

 

 


 

Line thickness

Global variables

Some available values

Description, comments, further reference

gp_lwidth

1

Default

 

4

lines 4 times thicker


 

Key

Global variables

Some available values

Description, comments, further reference

gp_key

no

 

 

yes

default location: top left

 

bottom left

 

 

top right

 

 

bottom right outside

 

 

350,100

places key at x = 350, y = 100

 

 

 

 

 

gnuplot reference

gp_keytitl

no

default

 

your key title

 

gp_keyopt

no

default

 

Left

left justification of labels (default)

 

reverse

reverse label and sample display

 

width -12

decrease the distance between label and sample by 12

 

samplen 4

determines length of sample in legend (4 = default)

 

spacing 1.25

vertical spacing between lines (1.25 = default)

 

Right noreverse width 6

can use combination

gp_keybox

no

default

 

0

no box

 

yes

box around legend

 

anything

box around legend

Axis ranges

Global variables

Some available values

Description, comments, further reference

gp_xrange

number1 : number2

uses x-axis range from number1 to number2

gp_yrange

number1 : number2

uses y-axis range from number1 to number2

 

no

gnuplot default

 

0

gnuplot default

gp_y2range

no

gnuplot default

 

number1 : number2

uses 2nd y-axis range from number1 to number2

Increments

Global variables

Some available values

Description, comments, further reference

gp_xinc

number

 

gp_yinc

number

 

 

no

gnuplot default

 

0

gnuplot default

 

 

 

 

 

 

Grid line

Global variables

Some available values

Description, comments, further reference

gp_gline

no

 

 

4

 

 

13

 

 

 

 

 

 

more gnuplot reference

Border style

Global variables

Some available values

Description, comments, further reference

gp_borddim

1

draws x-axis only

 

x

draws x-axis only

 

2

draws y-axis only

 

y

draws y-axis only

 

3

draws x-axis and y-axis

 

two

draws x-axis and y-axis

 

four

draws all axis

 

all

draws all axis

 

 

 

 

 

gnuplot reference


 

Font name

Global variables

Some available values

Description, comments, further reference

gp_font

Times New Roman

 

 

Arial Bold Italic

 

 

Helvetica

 

 

 

 

 

 

gnuplot reference


 

Comments  (back to top)

The interface has not been tested extensively.  Most of the testing was done using GAMSIDE and the terminal type "Windows".  Last changes were made in October 2003.  If you find bugs, or if you have questions or comments, please feel free to email Uwe at schneider@dkrz.de.
 

Credits  (back to top)

This software interface was jointly developed by Uwe Schneider and Bruce McCarl.  Substantial credit goes to Thomas Rutherford. His existing gnuplot interface provided extremely useful guidance for establishing this program. Additional contributions were made by Michael Bussieck and Armin Pruessner from GAMS Development Corporation. Thanks go to Bernhard Reiter and Hans-Bernhard Broeker from the GNUPLOT team.