|
Obtaining graphical output |
Top Previous Next |
|
Statements may be entered into a GAMS program that permit graphical displays of data computed during a GAMS run directly in a window on a PC using Rutherford's Gnuplot or Uwe Schneider's Gnupltxy. To graph data in a GAMS program I need to do three basic things.
LINES Lines in graph /A,B/ POINTS Points on line /1*10/ ORDINATES ORDINATES /X-AXIS,Y-AXIS/ ; TABLE GRAPHDATA(LINES,POINTS,ORDINATES) X-AXIS Y-AXIS A.1 1 1 A.2 2 4 A.3 3 9 A.4 5 25 A.5 10 100 B.1 1 2 B.2 3 6 B.3 7 15 B.4 12 36;
$LIBINCLUDE Gnupltxy GRAPHDATA Y-AXIS X-AXIS
where the first argument after Gnupltxy gives the array name, the second name of a set element in the third array position which contains the data coordinates for the y axis and the third the name of a set element in the third array position which contains the data coordinates for the x axis. In turn when I run I get two new windows that automatically open in front of the IDE
The window labeled Gnuplot graph is the graph of the data and the window labeled Gnuplot results from the execution of the source Gnuplot program. Use of such graphing is more extensively discussed and illustrated in the Links to Other Programs Including Spreadsheets chapter. |