GAMS to Gnuplot/Shademap to PowerPoint
Uwe A. Schneider & Ingo Huck
February 20 2008
September
22, 2008
May 25, 2010
Description
Download
GAMS Syntax
PowerPoint Import
Examples
Other GAMS interfaces from/to: ShadeMap Gnuplot Stata Powerpoint Html Awk
The tools available here allow users to put gnuplot figures obtained from GAMS runs into powerpoint. Please report bugs, improvements, or other comments to uwe.schneider{at}zmaw.de. Many thanks to Mark Horridge for producing a suitable version of shademap.
Powerpoint file with Macro for loading and emptying gnuplot figures and shaded maps
for Gnuplot: $setglobal gp_ppt yes
for Shademap: $setglobal sm_ppt yes
The above command inside your GAMS program saves all graphs produced by $libinclude gnuplotxyz .../$libinclude shademap ... as picture files in your working directory with automatically different file names. In addition, all file names and file locations will be written into a text file. These text files are named gams_ppt_list.txt and reside in the /inclib subdirectory of your gams system.
By gnuplot default and always for shademap, the picture format will be the memory sparing EMF. If you want other formats for gnuplot figures (i.e. GIF), you have to use the following statements in addition to the one above. Note that other formats have not been tested and may produce errors.
$setglobal gp_term <terminal name>
The title of the plot will be put as text box on each slide. The following text format modifiers can be used to determine the appearance of the slide title:
$setglobal
gp_ppt_fontname "Times New Roman"
$setglobal
gp_ppt_fontsize 25
$setglobal
gp_ppt_boldfont yes
The content of the title is determined through gp_title [and gp_loop1, ..., gp_loop4 if loops are involved] as described on the Gnuplot interface pages.
Occasionally, one runs the same plot producing file on different data sets in order to compare specific plots across different runs. If one uses only the $setglobal gp_ppt yes option, he/she could sequentially insert the entire figures produced by each run in one ppt file. However, this order would make a comparison difficult. To ease comparison across runs, one may want to order the slides in a specific way, where each slide is repeated for all runs before showing the next slide. To achieve such an order, the follwoing additional syntax must be used:
$setglobal gp_ppt_a b
where a and b have to be numbers between 1 and 9. a identifies how many comparison runs you have (Note that 2,3,4,6, and 9 runs go well with the print handout option in MS PowerPoint). b identifies the current run. For example, one could have the four following statements for four comparison runs, which should be executed one after another.
First run (perhaps using restart file a1)
$setglobal gp_ppt_4 1
*$setglobal gp_ppt_4 2
*$setglobal gp_ppt_4 3
*$setglobal gp_ppt_4 4
Last run (perhaps using restart file a4)
*$setglobal gp_ppt_4 1
*$setglobal gp_ppt_4 2
*$setglobal gp_ppt_4 3
$setglobal gp_ppt_4 4
$setglobal
gp_ppt_1_name " for population growth"
$setglobal gp_ppt_2_name "
for biodiversity decline"
$setglobal gp_ppt_3_name " for climate
change"
$setglobal gp_ppt_4_name " for mars people
landing"
To import the pictures from your GAMS run into POWERPOINT, open the Powerpoint file
The power point interface uses a small macro compiled in Visual Basics. To use it, you have to enable macros.
The dialogs differ for different languages and between Office 2003 and earlier and Office 2007 and later.
In MS Office 2007 (and later), opening a ppt which contains the macro for ppt import will show the following option bar:

![]()
click on Options ...

Choose "Enable this content" and click "OK".
The go to to the VIEW tab, click on MACROS, select EnterPictures, and click Run.
Now you are ready to use the picture adding macro.
In MS Office 2003, if you get the following dialog
click on "Enable Macro". If you don't get the dialog, your security settings are either too strong or too weak.
You can check your settings by going to "Tools" -- "Options" -- "Security" -- "Macro Security". Medium or lower security is required to run macros.
If macros are enabled, you are ready to use them. Go to "Tools" -- "Macro" -- "Macros.."
and run the "EnterPictures"
This gives you the following dialog:
Please check that the file path corresponds to your gams system. You can change and save it through the "Save Filepath and name" button.
Gnuplot figures and shaded maps can be loaded simultaneously
You can click on Insert Pictures to load all gnuplot or shademap pictures of your gams run in power point or you can delete are slides in your power point file.
a) Examine that the specified file path corresponds to the path to your active gams system
b) Check that all picture files which are specified in the file gams_ppt_list.txt exist and can be viewed. Picture files listed with 0KB may be empty files which will not work.
Note: You must install shademap and gnuplotxyz and extract these files in the gislib subdirectory of your GAMS system directory!
Run example_multi_ppt_plot.gms four times and activate each time the corresponding $setglobal gp_ppt_4 statement.
Open the ppt template and execute the contained macro. The slides should look as in this file web_multirestart.ppt
Print slides using handout options with 4 handouts per page (multirun_slides.pdf)