OBGYN MSc Stat Module (2016-2018) :
Graphic Programs and MacroPlot : Explanation and Help
MacroPlot Explanations and Code Templates Support for Individual Plotting Procedures in StatPgm 6. Graphic Editor
Introduction Codes for Bitmap Controls Codes for Plotting Area Controls Codes for Codes that Draw Objects
This page is divided into two sections.
  • The first section covers the MacroPlot concept and procedures, the basis for creating and editing graphics in this module
  • The second explains in detail how to use the procedures to create and edit graphics in the graphics editor program StatPgm 6. Graphic Editor

What is MacroPlot

MacroPlot was developed in the O&G Department of the Chinese University, and began as computer code fragments to format numbers before they were used in the graphic procedures in Microsoft Excel. These code fragments were combined for more complex and time consuming procedures, and evolved into programs to create and edit graphics, bypassing Excel. The programs are now on the Internet, being used about 10-30 times a day under the name of MacroPlot.

A small subset of MacroPlot procedures are selected for teaching graphics in this statistics module. The programs were edited to reduce complexity and choice, to make learning by students easier

How does MacroPlot works

The tasks to produce a graphical plot is divided into 2 stages.

  • In the first stage, the user or a computer program composes a series of plotting instructions (macros)
  • In the second stage, the program interprets the macros and produce the graphics.
  • By editing any of the macros and replot, the plot can be changed and improved.

Must I use MacroPlot

No. Excel can produce everything that the student's version of MacroPlot can. In most instances Excel can do the job better and quicker.

However, MacroPlot requires the user to define every component in a plot, imposing discipline on the user to think about every plotting task, and allows detailed changes to every component

MacroPlot is therefore introduced in the module to teach creation and editing of graphics, and not as an efficient graphical tool

Where is MacroPlot

Any of the StatPgms that produces graphics will support a MacroPlot editing text box and produces the resulting plot. They include the following


The MacroPlot codes consists of a number of macros, short codes that instruct the computer to perform a specific task. The following rules are built in to reduce confusion.

  • Each plotting task is controlled by a macro
  • Each macro occupies its own line in the code editor, and the image will be built in order of the macro lines
  • Each macro line contains a number of elements. The elements must be separated by a single space. Multiple space or tab should not be use as this may cause an erroneous plot.
  • Any line where the first word is not Image, Bitmap, Plot, Line, Font, or Fill will be ignored
  • The first macro must be Bitmap Initialise w h r g b a
  • Any plotting using data values must follow the Plot Values lv tv rv bv