Related Links:
MacroPlot Program Page
Introduction
MacroPlot Codes
Color Codes
Useful Tips
Introduction
MacroPlot Structure
This is the major help file for MacroPlot.
Macroplot was initially devised to produce two dimensional graphics for scientific publications
with the following objectives
- That it is simple and easy to use, requiring only a short learning curve
- That the program is small and easy to produce
- That it allows easy editing of the bitmap at the user interface
To achieve this, the production of a bitmap is separated into two stages. The first stage
is the production of macros, a series of meta-codes each controlling a graphical
procedure. The second stage is when the program interprets the macros and produce the bitmap.
The idea is for any statistical procedure to produce and publish the macros and the initial bitmap.
The user can then edit the macros to change line thickness, colors, and so on to produce the final bitmap.
MacroPlot is most commonly used within the web pages of StatTools. Once the user is satisfied
with the graphic produced, the bitmap can be harvested like any other graphic file on a web page, by right
clicking it, then copied to the clipboard or saved to a file.
As there are but few codes, and they are easy to remember, users increasingly create bitmaps by
directly writing the codes themselves. This in turn trigger the development of other macros
to increase the number of plotting functions and to handle the bitmap.
A further development is the conversion of macros into Visual Basic for Applications (VBA) codes,
which can be inserted into the macro box in PowerPoint to produce vector graphics. This greatly
expanded the usefulness of MacroPlot, as the vector graphic format is required by publishers of
scientific journal and books, as changing the size of the bitmap will then not cause distortions.
MacroPlot is controlled by a series of macros, each macro controls a plotting procedure in the
program. For most purposes in bio-social research, a presentable plot can be produced by 10-20
macros, and in more complex plots, up to 100 macros may be required. As modern computers have large memories,
the text area provided by the program can accommodate more than 2000 macros, way in excess of
what is usually required. Only in extreme situations, such as plotting a whole database of tens of thousands of
coordinates, does the program have to access macros in an external file, and only MacroPlot Desk top
can do this.
The macros, either in the text area of the program, or in a text file, must have the following structure
- Each macro must occupy its own line, and the elements in each line are separated by spaces or tabs
- Any macro that does not begin with one of the 6 key words Image Bitmap Plot Line Fill and Font is
considered by the program as irrelevant and ignored. The key word, the first element in the macro,
is case insensitive.
- Macros beginning with the key word Image which access computer files and clipboard
only work in the desk top version of the program.
- The program performs plotting tasks in the order of the macro list. Any setting of colors,
line thickness, and fonts will be used in subsequent plotting tasks until they are changed.
The first macro, which begins the plotting tasks, must be one of the initialisation statements. The three are
- Image Initialise filename initialises using an existing bitmap in file, and only works in the desk top program
- Image Initialise clipboard initialises using a bitmap currently in the clipboard, and only works in the desk top program
- Bitmap Initialise width height red green blue alpha initialises a blank bitmap of size width x height,
with background color defined by red, green, blue, and alpha (all 0-255). This is the only initialising procedure
that works in a php program, an applet, and the desk top program.
Once initialised, all plotting commands begins with the keyword Bitmap. The coordinates
used for plotting is x/y, where x is the number of pixels from the left border, and y
the number of pixels from the top border.
In most plotting tasks, coordinates are related to the values of the variables used.
To enable plotting using variable values, the following macros are used.
- The central area for plotting is defined by default as 15% of the width from the left,
5% of the width from the right, 5% of the height from the top, and 15% of the height from the bottom.
The greater margin on the left and bottom are to allow labelling. In most cases this default can be used.
- To override the default, the macro Plot Pixels lp tp rp bp can be used, where lp and rp
are the left and right border of the plotting areas, defined by pixel numbers counting from the left,
and tp and bp the top and bottom borders, defined by pixel numbers from the top.
- The macro Plot Values lv tv rv bv is obligatory. lv and rv define the x values at pixel lp
and rp, while tv and bv defines the y values at tp and bp. This macro allows the program to subsequently transforming
x and y values into pixel numbers for plotting.
Once the values are defined, plotting commands with the keyword Plot can be used, and
the coordinates refers to x or y values within the range declared by lv-rv and bv-tv
Conventions used in MacroPlot
- Coordinates in Bitmap macros are pixels x the number of pixel from the left border, y number of pixel from the top border
- Coordinates in Plot macros are values within the range defined in the Plot Values
lv tv rv bv
- Distances such as radius or shifting a plot are in number of pixels
- Angles are in degrees (0 to 360) with 0 at 3 O'clock and going clockwise
- Color of lines, fonts, and fill during plotting are as most recently assigned
- Text to be written onto the bitmap must be one word with no gap. If a gap is needed
the underscore is used, which is removed before plotting. e.g. Hello_There will
be converted to Hello There
Image
Bitmap
Plot
Line Fill Font
Introduction
Image I/O
Image Change Size
Image Color
Macros that begins with the keyword Image mostly perform procedures on the whole image. Nearly all of the
Image macros are used in the desk top program, and are mostly irrelevant to users who access MacroPlot via the web page.
They are included on the web page only as a matter of records.
Image Initialise FileName
- This command is used only in desk top programs, and irrelevant to the web page.
- It Initialises a new image using a bitmap file named FileName. FileName is rooted in the folder that contains the program
- e.g. Image Initialise myBitmap.png
- e.g. Image Initialise c:/User/Me/pics/aBitmap.gif
Image Initialise Clipboard
- This command is used only in desk top programs, and irrelevant to the web page.
- It Initialises a new image using a bitmap residing on the clipboard currently
Image FromFile x y fileName
- This command is used only in desk top programs, and irrelevant to the web page.
- It places the bitmap from file named filename on top of the existing bitmap, with the left top
corner of the bitmap from file at the x,y pixel of the existing bitmap
- e.g. Image FromFile 50 100 aBitmap.gif
Image FromClipboard x y
- This command is used only in desk top programs, and irrelevant to the web page.
- It places the bitmap currently in the clipboard on top of the existing bitmap, with the left top
corner of the bitmap from clipboard at the x,y pixel of the existing bitmap
- e.g. Image FromClipboard 50 100
Image ToFile fileType fileName
- This command is used only in desk top programs, and irrelevant to the web page.
- It saves the current image into a file called fileName in the format of fileType
- e.g. Image ToFile png myImage.png
Image ToClipboard
- This command is used only in desk top programs, and irrelevant to the web page.
- It places the current image onto the clipboard
Image ChangeSizeByHeight h
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes the size of the current image to a height of h pixels, maintaining the aspect ratio
- e.g. Image ChangeSizeByHeight 300
Image ChangeSizeByWidth w
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes the size of the current image to a width of w pixels, maintaining the aspect ratio
- e.g. Image ChangeSizeByWidth 500
Image ChangeSize w h
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes the size of the current image to a width of w pixels and height of h pixels
- e.g. Image ChangeSize 700 500
Image Transparency alpha
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes the transparency alpha value to 0(transparent) to 255(opaque)
- e.g. Image Transparency 0
Image Monochrome levels
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes the current image to black white and grey. Level can be 2 for black/white, 3
for additional grey, and 5 for 3 shades of grade.
- e.g. Image Monochrome 3
Image ChangeColor oR oG oB oA nR nG nB nA
- This command is used only in desk top programs, and irrelevant to the web page.
- It changes a color (rgba(oldRed, oldGreen oldBlue oldAlpha) in the current bitmap to another color
rgb(newRed newGreen newBlue newAlpha).
- Note : In php program, alpha is either 0 or 255, there is no gradation.
Image AddPixel r g b a nLeft nTop nRight nBottom
- This command is used only in desk top programs, and irrelevant to the web page.
- It enlarges the pixel with a color (rgba(r g b a) by placing additional number of pixels to its
left, top, right, and bottom.
- e.g. Image AddPixel 0 0 0 255 1 0 1 0 widens each black pixel by adding 1 pixel to its left and right
A Macro beginning with the word Bitmap handles the bitmap in pixel forms. The x location
refers to the number of pixels from the left border, and the y location the number of pixels from the top border
Bitmap Initialise w h r g b a
- This is the first, obligatory command in any bitmap creation on a web page
- This creates a blank bitmap w pixels wide and h pixels in height and the background color of
rgba(red green blue alpha), each with values 0-255. Note alpha a is optional, having a default value of 255 if unstated
- e.g. Bitmap Initialise 700 500 255 255 255 255 initialises a bitmap 700 pixels wide and 500 pixels high,
with solid white background.
- Note : There is an incompatibility between some web browsers and desk top applications,
in that a bitmap with transparent background produced on the web page, when copied and pasted via the clipboard to other
desk top applications such as Powerpoint or Word, the background appears black. However if the bitmap on the web
page is saved as a .png file, then inserted from the file into the desk top application, then the background transparency
works as intended. Alternatively, the background can be opaque White (255 255 255 255), and after copying to Powerpoint, use
the formatting tool of the powerpoint to convert white to transparent.
Bitmap FloodFill x y r g b a
- This command is used only in desk top programs, and irrelevant to the web page.
- It starts at the pixel defined by x/y, changes it and all pixels with the color of that pixel
to the new color of rgba(r g b a), extending in all directions until it reaches the bitmap border or a pixel
with a different color
- e.g. Bitmap FloodFill 0 0 255 0 0 255
Bitmap FloodToBorder x y bR bG bB bA nR nG nB nA
- This command is used only in desk top programs, and irrelevant to the web page.
- It starts at the pixel defined by x/y, changes it to the new color rgba(nR nG nB nA),
extending in all directions until it reaches the bitmap order or a pixel with the color
rgba(bR bG bB bA)
- e.g. Bitmap FloodToBorder 0 0 255 0 0 255 0 0 255 255 starts left top corner, turns
all pixels solid blue(0 0 255 255) until it comes across a red pixel (255 0 0 255)
Bitmap Bar x1 y1 x2 y2
- Draws a bar with the corners at x1,y1 and x2,y2.
- e.g. Bitmap Bar 10 12 20 15
Bitmap Line x1 y1 x2 y2
- Draws a line from x1,y1 to x2,y2
- e.g. Bitmap Line 0 0 20 30
Bitmap Oval xRadius yRadius x y
- Draws an oval centered on x and y with xRadius the radius for width and yRadius the radius for height
- e.g. Bitmap Oval 5 10 50 60 oval centres at x=50 and y=60, xradius = 5 and y radius = 10
Bitmap Polygon x y radius nSides startDegree
- Draws an polygon centered at x,y and radius as defined. It has nSides sides (e.g.triangle is 3 and pentagon is 5),
and the first point is at startDegree (0 is at 3 O'clock and the angle increases clockwise
- e.g. Bitmap Polygon 50 60 20 5 270 a pentagon centered at x=50 and y=60, a radius of 20 pixels, 5 sides
with the first point pointing upwards (270 degrees)
Bitmap Dot radius x y
- Dots are used to plot data points in a two dimensional bitmap. A number of dot types are available (see below).
- The dot is centered on x,y coordinate, with the defined radius. Examples of standard dots are
- Bitmap circle 5 10 20
- Bitmap square 5 10 20
- Bitmap diamond 5 10 20
- Bitmap UTriangle 5 10 20
- Bitmap DTriangle 5 10 20
- Bitmap LTriangle 5 10 20
- Bitmap RTriangle 5 10 20
- Bitmap plus 5 10 20
- Bitmap cross 5 10 20
Bitmap HText halign valign x y text
- Draws horizontal text at pixels coordinate x y
- halign= horizontal alignment 0=left 1=center 2 = right
- valign= vertical alignment 0=top 1=middle 2=bottom
- text a single word using underscore _ for space
- e.g. Bitmap HText 0 0 10 10 Hello_there
Bitmap VText halign valign x y text
- Draws vertical text (horizontal text rotated 90 degrees anticlockwise at pixels coordinate x y
- halign= horizontal alignment 0=left 1=center 2 = right
- valign= vertical alignment 0=top 1=middle 2=bottom
- text a single word using underscore _ for space
- e.g. Bitmap VText 0 0 10 10 Hello_there
Bitmap HLabel label d
- Places a single word heading label (with underscore _ for gaps) in the center of the bitmap d pixels from the top of the bitmap
- e.g. Bitmap HLabel My_Picture 10
Bitmap Wedge x y radius shift startAngle FinishAngle txt
- Places a wedge on the bitmap.
- x y = pixel coordinate of centre of wedge circle
- radius = radius of wedge circle
- shift = number of pixel the whole wedge is shifted centrifugally
- Start and end angles are degrees (0-360) going anticloclwise from 0 at 3 O'clock
- txt is text to put inside the wedge. It can be left out, resulting in no labelling of the wedge
- e.g. Bitmap Wedge 200 200 100 10 90 180 A_Big_Wedge
Introduction
Plot Set Up
Plot Axis and Scaling
Plot Plotting
A Macro beginning with the word Plot controls an inner area of the bitmap, where all the graphics are related
to defined values in the data
Plot has three sections
- Set up : macros that defines the area and the range
- Axis and Scaling : macros that draw the axis and write the scaling on the edge of the plotting area
- Plotting : Places plotting rlrments inside the plot area.
Plot Pixels lp tp rp bp
- Defines the plotting area by pixels left top right bottom
- e.g. Plot Pixels 20 10 400 300 plotting area in pixels from top left corner x 20-400 y 10-300
- Note : This command is mostly not necessary, as when a bitmap is initialised, the inner area is defined by
default to be 15% from the left and bottom, and 5% from top and right. This command is only used if the
default is to be overwritten
Plot Values lv tv rv bv
- Defines the x and y values at the ends of the plotting area
- e.g. Plot Values -4.0 100.0 4.0 0.0 provides values from x= -4 (left) to +4(right) and y from 100(top) to 0(bottom)
- Note : This command is obligatory for all subsequent Plot commands, as it defines the relationship between values and pixels
Plot XLog v
- Defines whether the x values are in logarithmic scale (v=1) or normal scale (v=0).
- The default value is normal scale, so this command is only necessary if log scale is required
- e.g. Plot XLog 1
Plot YLog v
- Defines whether the y values are in logarithmic scale (v=1) or normal scale (v=0).
- The default value is normal scale, so this command is only necessary if log scale is required
- e.g. Plot YLog 1
Plot XLabel label d
- Places the label d pixels below the bottom of the plotting area.
- e.g. Plot XLabel This_is_X_Label 25
Plot YLabel label d
- Places the label d pixels left of the plotting area.
- e.g. Plot YLabel This_is_Y_Label 45
Plot XAxisMark y start interval length
- Marks the intervals in x axis
- y = y value where the x axis is
- start = the x value of first mark it must be within range lv-rv
- interval = distance in values between marks
- length = length of mark line in pixels + downwards, - upwards
- e.g. Plot XAxisMark 10.5 2.0 0.5 -5
- Please Note : this command is superceeded by the Plot XAxis and is usually not necessary
Plot YAxisMark x start interval length
- Marks the intervals in y axis
- x = x value where the y axis is
- start = the y value of first mark it must be within range tv-bv
- interval = distance in values between marks
- length = length of mark line in pixels + to the right, - to the left
- e.g. Plot YAxisMark 2.5 10.0 5.0 5
- Please Note : this command is superceeded by the Plot YAxis and is usually not necessary
Plot XAxisScale y start interval gap
- Writes the numerical scale of x axis
- y = y value where the x axis is
- start = the x value of first value written it must be within range lv-rv
- interval = distance in values between marks
- gap = distance in pixels between x axis and top of scale text positive value=below axis, negative value=above axis
- Note format of numerical output is modelled on the interval
- e.g. Plot XAxisScale 10.5 3 1.5 3
- Please Note : this command is superceeded by the Plot XAxis and is usually not necessary
Plot YAxisScale x start interval gap
- Writes the numerical scale of y axis
- x = x value where the y axis is
- start = the y value of first value written it must be within range tv-bv
- interval = distance in values between marks
- gap = distance in pixels between y axis and right end of scale text positive value=right of the axis, negative value=left of the axis
- Note format of numerical output is modelled on the interval
- e.g. Plot Plot YAxisScale 2.5 10 20 -3
- Please Note : this command is superceeded by the Plot YAxis and is usually not necessary
Plot XAxis y markStart markInterval scaleStart scaleInterval
- Draw the whole x axis
- y is the y value where the x axis is drawn
- markStart and markInterval are where the marks are placed
- scaleStart and scaleInterval are where the values of the scales are written
- Note format of numerical output is modelled on the scaleInterval
- e.g. Plot XAxis 10.5 0.5 0.5 1.5 1.5
Plot YAxis x markStart markInterval scaleStart scaleInterval
- Draw the whole Y axis
- X is the X value where the Y axis is drawn
- markStart and markInterval are where the marks are placed
- scaleStart and scaleInterval are where the values of the scales are written
- Note format of numerical output is modelled on the scaleInterval
- e.g. Plot YAxis 10.5 0.5 0.5 1.5 1.5
Plot XAxisLogMark y length
- Marks x axis which when XLog=1 and rv>lv
- y = y value where the x axis is
- length = length of mark line in pixels + downwards - upwards
- e.g. Plot XAxisLogMark 10.8 -5
- Please Note : this command is superceeded by the Plot XAxisLog and is usually not necessary
Plot YAxisLogMark x length
- Marks y axis which when YLog=1 and tv>bv
- x = x value where the y axis is
- length = length of mark line in pixels + to the right, and - to the left
- e.g. Plot YAxisLogMark 2.5 3
- Please Note : this command is superceeded by the Plot YAxisLog and is usually not necessary
Plot XAxisLogScale y gap
- Places numerical scale on x axis which when XLog=1 and rv>lv
- y = y value where the x axis is
- gap = distance in pixels between x axis and top of scale text, + below axis, and - above axis
- e.g. Plot XAxisLogScale 10.8 3
- Please Note : this command is superceeded by the Plot XAxisLog and is usually not necessary
Plot YAxisLogScale x gap
- Places numerical scale on y axis which when YLog=1 and tv>bv
- x = x value where the y axis is
- gap = distance in pixels between y axis and right end of scale text, + right of axis, and - left of axis
- e.g. Plot YAxisLogScale 2.5 -5
- Please Note : this command is superceeded by the Plot YAxisLog and is usually not necessary
Plot XAxisLog y
- Draws complete logarithmic x axis at value y
- e.g. Plot XAxisLog 10.5
Plot YAxisLog x
- Draws complete logarithmic y axis at value x
- e.g. Plot YAxisLog 10.5
Plot Line x1 y1 x2 y2 xShift yShift
- Draws a line, using x and y values, from x1,y1 to x2,y2, then shifts the line xshift pixels (- to the left and + to the right),
and yShift pixels (- upwards and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot Line 2.2 10.5 9.0 50.6 0 0 is the same as Plot Line 2.2 10.5 9.0 50.6
- e.g. Plot YAxisLog 10.5
Plot Bar x1 y1 x2 y2 xShift yShift
- Draws a bar, using x and y values, with corners at x1,y1 and x2,y2, then shifts the bar xshift pixels (- to the left and
+ to the right) and yShift pixels (- upwards and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot Bar 2.2 10.5 9.0 50.6 0 0 is the same as Plot Bar 2.2 10.5 9.0 50.6
Plot VBar hw x y1 y2 xShift
- Draws a vertical bar at x value, and vertically from y1 to y2 values, the thickness of the bar is 2 x hw (half width) pixels,
then the whole bar is shifted by xShift pixels (- to the left and + to the right).
- The default value for xShift is 0 if it is not stated
- e.g. Plot VBar 5 15.0 0.0 100.0 0 is the same as Plot VBar 5 15 0 100. It draws a vertical bar 11 pixels
wide (x±5), at x=15, and y from 0 to 100, with no shift(0)
Plot HBar hh x1 x2 y yShift
- Draws a horizontal bar from x1 to x2 values, at y value, with the height of 2 x hh (half height) pixels, then the whole
bar is shifted by yShift pixels (- upwards and + downwards).
- The default value for yShift is 0 if it is not stated
- e.g. Plot VBar 5 15.0 30.0 50.0 0 is the same as Plot VBar 5 15 0 100. It draws a horizontal bar 11 pixels
high (y±5), x from 15 to 30, at y=50, with no shift (0)
Plot Oval xRadius yRadius x y xShift yShift
- Drawa an oval centered at x and y values, having its x and y radius as xRadius and yRadius in values (not pixels).
- The whole oval is then shifted by xShift pixels (- to the left, and + to the right) and yShift pixels (- upwards and
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot Oval 5.0 8.0 50.0 50.0 0 0 is the same as Plot Oval 5.0 8.0 50.0 50.0
Plot Polygon x y radius nSides startAngle shiftX shiftY
- Draws a polygon centered at x,y values, and radius in pixels. It has nSides sides (e.g. triangle is 3 and pentagon is 5), and
the first point is at startDegree (0 is at 3 O'clock, clockwise).
- The whole polygon is then shifted by xShift pixels (- to the left, and + to the right) and yShift pixels (- upwards
and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot Polygon 50.0 60.0 20 5 270 0 0 is the same as Plot Polygon 50.0 60.0 20 5 270
Plot Dot radius x y xShift yShift
- Dots are used to plot data points in a two dimensional bitmap. A number of dot types are available (see below).
- The dot is centered on x,y values, with the defined radius in pixels.
- The dot is then shifted by xShift pixels (- to the left, + to the right) and yShift pixels (- upwards and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- Examples of standard dots are
- Plot circle 5 10.0 2.00 0 is the same as Plot circle 5 10.0 20.0
- Plot square 5 10.0 20.0 0 is the same as Plot square 5 10.0 20.0
- Plot diamond 5 10.0 20.0 0 is the same as Plot diamond 5 10.0 20.0
- Plot UTriangle 5 10.0 20.0 0 is the same as Plot UTriangle 5 10.0 20.0
- Plot DTriangle 5 10.0 20.0 0 is the same as Plot DTriangle 5 10.0 20.0
- Plot LTriangle 5 10.0 20.0 0 is the same as Plot LTriangle 5 10.0 20.0
- Plot RTriangle 5 10.0 20.0 0 is the same as Plot RTriangle 5 10.0 20.0
- Plot plus 5 10.0 20.0 0 is the same as Plot plus 5 10.0 20.0
- Plot cross 5 10.0 20.0 0 is the same as Plot cross 5 10.0 20.0
Plot HText halign valign x y text shiftX shiftY
- Draws horizontal text at value coordinate x y
- halign= horizontal alignment 0=left 1=center 2 = right
- valign= vertical alignment 0=top 1=middle 2=bottom
- text a single word using underscore _ for space
- The text is then shifted by xShift pixels (- to the left, + to the right) and yShift pixels (- upwards and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot HText 0 0 2.5 10.6 Hello_there 0 0 is the same as Plot HText 0 0 2.5 10.6 Hello_there
Plot VText halign valign x y text shiftX shiftY
- Draws vertical text at value coordinate x y
- halign= horizontal alignment 0=left 1=center 2 = right
- valign= vertical alignment 0=top 1=middle 2=bottom
- text a single word using underscore _ for space
- The text is then shifted by xShift pixels (- to the left, + to the right) and yShift pixels (- upwards and + downwards).
- Default values for xShift and yShift are 0 and 0. Bothe shifts must be included or left out
- e.g. Plot VText 0 0 2.5 10.6 Hello_there 0 0 is the same as Plot VText 0 0 2.5 10.6 Hello_there
Plot Curve a b1 b2 b3 b4 b5 x1 x2
- Draws a polynomial curve y = a +b1x + b2x2sup> + b3x3sup> + b44sup> + b5x5sup>,
from x values of x1 to x2
- e.g. Plot Curve 15.1 0.6 -0.8 0.0 0.0 0.0 2.5 2.6 draws quadratic line y=15.1 +0.6x -0.8x2sup> from x=2.5 to x=2.6
Plot Normal mean sd typ
- Draws normal (Gaussian) curve of mean and sd from -4SD to +4 sd for x and percent for height, where typ controls the
maximum height, which depends on how the data are grouped
- typ = 0 : data groups by 1 SD maximum height = % of cases between -0.5SD to +0.5SD = 38.3%
- typ = 1 : data groups by 0.5 SD maximum height = % of cases between -0.25SD to +0.25SD = 19.74%
- typ = 2 : data groups by 0.25 SD maximum height = % of cases between -0.125SD to +0.125SD = 9.94%
- typ = 3 : data groups by 0.125 SD maximum height = % of cases between -0.0625SD to +0.0625SD = 4.98%
- e.g. Plot Normal 0 1 1
Format
Formatting macros defines size and color of the output elements. Once declared, all subsequent drawings will
conform to the format until ist is changed. Formatting comes under the 3 Macro beginnings of Line, Fill, and Font
Line Color red green blue alpha
- Defines the color of lines drawn and text output. The 4 color values are from 0 to 255,
- The default value for Alpha is 255 (full color no transparency) if it is not stated
- e.g. Line Color 255 0 0 255 is the same as Line Color 255 0 0, solid red lines and fonts
- The default line and font color is black non-transparent (0 0 0 255)
Line Thick p
- Defines the width or thickness of lines p = thickness in number of pixels
- e.g. Line Thick 3
- The default line thickness is 1 pixel
Fill Color red green blue alpha
- Defines the filling or background color of circles, bars, etc. The 4 color values are from 0 to 255,
- The default value for Alpha is 255 (full color no transparency) if it is not stated
- e.g. Fill Color 255 0 0 255 is the same as Fill Color 255 0 0
- The default fill color is white non-transparent (255 255 255 255)
Font Type v
- Defines the font to use for text output
- v can be one of the 4 standard fonts
- 0=arial(sans serif)
- 1=times(serif)
- 2=cour(monospaced)
- 3=verdana (Serif)
- The default font type is Verdana
Font Style s
- Defines the font style, where 0=normal, 1=bold
- e.g. Font Style 1
- The default font style is 0 (normal)
Font Size h
- Defines the font size, height in pixels
- e.g. Font Size 16
- The default font size is 14
Font Color red green blue alpha Calling Font Color results in the same as calling Line Color
Plain Color
Color Palette
0 0 0 #000000 | 0 0 63 #00003f | 0 0 127 #00007f | 0 0 191 #0000bf | 0 0 255 #0000ff |
0 63 0 #003f00 | 0 63 63 #003f3f | 0 63 127 #003f7f | 0 63 191 #003fbf | 0 63 255 #003fff |
0 127 0 #007f00 | 0 127 63 #007f3f | 0 127 127 #007f7f | 0 127 191 #007fbf | 0 127 255 #007fff |
0 191 0 #00bf00 | 0 191 63 #00bf3f | 0 191 127 #00bf7f | 0 191 191 #00bfbf | 0 191 255 #00bfff |
0 255 0 #00ff00 | 0 255 63 #00ff3f | 0 255 127 #00ff7f | 0 255 191 #00ffbf | 0 255 255 #00ffff |
63 0 0 #3f0000 | 63 0 63 #3f003f | 63 0 127 #3f007f | 63 0 191 #3f00bf | 63 0 255 #3f00ff |
63 63 0 #3f3f00 | 63 63 63 #3f3f3f | 63 63 127 #3f3f7f | 63 63 191 #3f3fbf | 63 63 255 #3f3fff |
63 127 0 #3f7f00 | 63 127 63 #3f7f3f | 63 127 127 #3f7f7f | 63 127 191 #3f7fbf | 63 127 255 #3f7fff |
63 191 0 #3fbf00 | 63 191 63 #3fbf3f | 63 191 127 #3fbf7f | 63 191 191 #3fbfbf | 63 191 255 #3fbfff |
63 255 0 #3fff00 | 63 255 63 #3fff3f | 63 255 127 #3fff7f | 63 255 191 #3fffbf | 63 255 255 #3fffff |
127 0 0 #7f0000 | 127 0 63 #7f003f | 127 0 127 #7f007f | 127 0 191 #7f00bf | 127 0 255 #7f00ff |
127 63 0 #7f3f00 | 127 63 63 #7f3f3f | 127 63 127 #7f3f7f | 127 63 191 #7f3fbf | 127 63 255 #7f3fff |
127 127 0 #7f7f00 | 127 127 63 #7f7f3f | 127 127 127 #7f7f7f | 127 127 191 #7f7fbf | 127 127 255 #7f7fff |
127 191 0 #7fbf00 | 127 191 63 #7fbf3f | 127 191 127 #7fbf7f | 127 191 191 #7fbfbf | 127 191 255 #7fbfff |
127 255 0 #7fff00 | 127 255 63 #7fff3f | 127 255 127 #7fff7f | 127 255 191 #7fffbf | 127 255 255 #7fffff |
191 0 0 #bf0000 | 191 0 63 #bf003f | 191 0 127 #bf007f | 191 0 191 #bf00bf | 191 0 255 #bf00ff |
191 63 0 #bf3f00 | 191 63 63 #bf3f3f | 191 63 127 #bf3f7f | 191 63 191 #bf3fbf | 191 63 255 #bf3fff |
191 127 0 #bf7f00 | 191 127 63 #bf7f3f | 191 127 127 #bf7f7f | 191 127 191 #bf7fbf | 191 127 255 #bf7fff |
191 191 0 #bfbf00 | 191 191 63 #bfbf3f | 191 191 127 #bfbf7f | 191 191 191 #bfbfbf | 191 191 255 #bfbfff |
191 255 0 #bfff00 | 191 255 63 #bfff3f | 191 255 127 #bfff7f | 191 255 191 #bfffbf | 191 255 255 #bfffff |
255 0 0 #ff0000 | 255 0 63 #ff003f | 255 0 127 #ff007f | 255 0 191 #ff00bf | 255 0 255 #ff00ff |
255 63 0 #ff3f00 | 255 63 63 #ff3f3f | 255 63 127 #ff3f7f | 255 63 191 #ff3fbf | 255 63 255 #ff3fff |
255 127 0 #ff7f00 | 255 127 63 #ff7f3f | 255 127 127 #ff7f7f | 255 127 191 #ff7fbf | 255 127 255 #ff7fff |
255 191 0 #ffbf00 | 255 191 63 #ffbf3f | 255 191 127 #ffbf7f | 255 191 191 #ffbfbf | 255 191 255 #ffbfff |
255 255 0 #ffff00 | 255 255 63 #ffff3f | 255 255 127 #ffff7f | 255 255 191 #ffffbf | 255 255 255 #ffffff |
Table of colors used on this web site
255 255 255 #ffffff | 224 224 224 #e0e0e0 | 128 128 128 #808080 | 128 0 0 #800000 | 255 0 0 #ff0000 |
96 48 96 #603060 | 48 16 64 #301040 | 96 96 160 #6060a0 | 160 160 96 #a0a060 | 160 160 0 #a0a000 |
153 191 164 #99bfa4 | 160 160 96 #a0a060 | 97 24 0 #611800 | 204 63 200 #cc3fc8 | 224 224 224 #e0e0e0 |
Patterns of complementary colors
A | 105 93 70 #695d46 | 255 113 44 #ff712c | 207 194 145 #cfc291 | 161 232 217 #a1e8d9 | 255 246 197 #fff6c5 |
B | 115 0 70 #730046 | 201 60 0 #c93c00 | 232 136 1 #e88801 | 255 194 0 #ffc200 | 191 187 17 #bfbb11 |
C | 97 24 0 #611800 | 140 115 39 #8c7327 | 71 164 41 #47a429 | 153 191 164 #99bfa4 | 242 239 189 #f2efbd |
D | 20 87 110 #14576e | 140 33 90 #8c215a | 230 133 38 #e68526 | 195 102 163 #c366a3 | 242 207 242 #f2cff2 |
E | 64 1 1 #400101 | 48 115 103 #307367 | 96 166 133 #60a685 | 242 236 145 #f2ec91 | 229 249 186 #e5f9ba |
F | 55 89 21 #375915 | 166 60 60 #a63c3c | 115 108 73 #736c49 | 166 157 129 #a69d81 | 242 224 201 #f2e0c9 |
G | 115 36 94 #73245e | 166 69 33 #a64521 | 217 182 78 #d9b64e | 242 218 145 #f2da91 | 242 242 242 #f2f2f2 |
H | 255 77 0 #ff4d00 | 102 87 71 #665747 | 125 179 0 #7db300 | 153 138 122 #998a7a | 217 195 98 #d9c362 |
I | 128 0 38 #800026 | 128 128 83 #808053 | 92 153 122 #5c997a | 163 204 143 #a3cc8f | 255 230 153 #ffe699 |
Harvesting Bitmap
Visual Basic Codes
Bitmap produced by MacroPlot on the web page can be harvested in the same manner as any other bitmap attached to a web page,
by right clicking the mouse over the bitmap, and choose copy to clipboard or save picture as file.
Alternatively, the bitmap can be harvested by using screen capture facilities of the computer.
- If the computer is a Windows based PC, then pushing the Prnt Scrn button on the keyboard near the top right corner will
capture the desk top screen as a bitmap to the clipboard.
- In some Window based computers, such as the Microsoft Suface, no print screen button is provided. Users will need to consult
the technical manuals for the protocol of screen capture. For example, for the Surface, it is ctrl+Fn+spacebar
- If the computer is the Mac from Apple, the desktop can be saved as a bitmap file (.png) on clicking Command+Shift+3. The file can then be opened in a graphic editor and edited. Alternatively, clicking Command+Shift+4 will initiate a cursor, which is used to mark the portion of the screen to be saved as a file. In both cases, the .png file is saved under desktop, and the file icon displayed on the screen.
There are incompatibilities between web browsers and desk top programs such as Microsoft Office, in that any alpha value
(governing transparency of colors) that is not the maximum of 255 will appear black when the bitmap is transferred using the clipboard.
To get around this problem, users should use one of the following strategies is they create bitmaps with transparency controls.
- Right click on the bitmap, and save it as a file, then import that file from the desk top program such as Powerpoint. The
image will from then on have no problems.
- Use the default alpha value of 255 for all colors, then transfer the image via clipboard to the desk top program. Use the
transparency tools of the desk top program to modify the bitmap.
Initially, StatTools produces its graphic as a bitmap, of the .png type. This works well for
web pages and slides, but is problematical for printouts and publications, as the graphic distorts when the size changes.
On the suggestions of users therefore, a vector graphic capability is included.
Macroplot converts each macro into a VBA plotting code, organized into a number of subroutines, and these can be copied
and pasted into the macro editor in PowerPoint. When these macros are run, the plot is reproduced as a Vector Graphic
bitmap in Powerpoint, which can be modified, copied, and handled as any other bitmap in Powerpoint.
Visual Basic Macros and Powerpoint
This section is for those not familiar with using VBA macros with Powerpoint.
Microsoft Office provides a facility that allows short programs, known as macros, written in Visual Basic for Applications
(VBA), to run in the background. The intension is to reduce tedious and repetitive tasks to a keystroke.
As a large library of subroutine is provided for this purpose, this macros facility is a very powerful tool, and many
commercial software are written for Office documents using macros.
Although the major part of the library can be used for all Office documents, some are more
specific. Users should therefore be aware that the macros produced by MacroPlot are specific for PowerPoint.
For those unfamiliar with using macros on PowerPoint, there are many web pages and tutorials
on the Internet to help them. Microsoft has also provided documentations, and the ones
I found most useful in my development of this program are in the link section.
However, to use the codes provided by MacroPlot, all the user needs to do is to open the macros editor,
paste the codes in, and click run.
Different versions of PowerPoint
The macros are tested on the 2007 and 2010 versions of PowerPoint.
The codes work on both these version except the pie chart, which will not work on
the 2007 version, because the auto shaped pie is named differently and is stored in the Office directory,
so calling for it in the program will flag an error.
The macro editor is in different spots also. For the 2007 version, it can be
found on the menu bar Tools→macros. For the 2010 version, the macros button is on the view panel.
Security, Permission and File names
Hackers have targeted Microsoft Office, hiding their malicious codes as macros.
Consequently, in the more recent versions of Office, the macros utility is blocked
by default, files containing macros have to have a specific appendix before macros
can be saved, and users need to switch the block off at the computer level before
macro containing files can be opened.
Consequently, there are dire warnings everywhere, and complicated procedures explained,
whenever the macro editor is switched on.
Fortunately, none of these applied to using macros produced by MacroPlot,
as Powerpoint is opened without macros, the macros are pasted into the editor and run
in the debugging mode, and macros are not saved when PowerPoint closes.
In other words, other than looking at the macros (which are texts) to make sure
there are no malicious codes attached, users can ignore all the security issues raised by Office.
If the macros need to be saved, save it as a text file, separate from Powerpoint.
VBA produced by MacroPlot
The intension of the program is to produce VBA macros which can be copied in whole,
pasted into the macros editor of PowerPoint, produce the graphics in PowerPoint, then deleted.
It is therefore essential that the volume of code be reduced to the absolute minimum to make the
whole process easier. Whenever possible therefore abbreviations are used.
For most users, there is no need to understand the codes produced, as the primary purpose
is to duplicate the graphics in PowerPoint
For those who wishes to reuse the macros, or to tweak it in some way, the following explanations of the abbreviations may be useful.
- lTh represents line thickness or weight. It is directly translated from the program where it
meant the number of pixels, but in Powerpoint, they will be used as weights. The thickness
of the lines are therefore similar but not exactly the same.
- lCl represents line color, and is usually set as RGB(red, green, blue) from 0 to 255.
Please note transparency is not set here.
- lTp represents line type. As StatTools uses only solid lines, the default is msoLineSolid.
For those who wishes to tweak this manually, the following are available. msoLineSolid
msoLineRoundDot msoLineSquareDot msoLineDash msoLineDashDot msoLineLongDash
msoLineLongDashDot msoLineDashDotDot
- foSz represents font size in points
- foNm represents font name. StatTools uses only 4 fonts, Arial and Verdana, both
non serif, Times which is serif, courier which is monospaced. Verdana is used as the default.
Users may substitute any font name that is available in their copy of PowerPoint
- foCl represents font color, and is usually set as RGB(red, green, blue) from 0 to 255.
- foSt represents font style, 0 for normal and 1 for bold. Currently italics and underlines are not supported.
- fiCl represents fill color, and is usually set as RGB(red, green, blue) from 0 to 255.
- fiTp represents fill type, 0 for transparent and 1 for solid. Whenever a fill
color is set, the program switches fiTp to 1 (solid), and to set fill to transparent
the command fitp = 0 is needed. Currently patterns and shading are not supported.
MacroPlot also produces the following supportive subroutines, which are included in each set of macros.
- Sub ASh(shapeType, x, y, w, h) adds a shape on the slide.
x and y represents the left top corner of the shape, w and h represents the
width and height. Colors, lines and fill are as defined by module level variables.
This command will place any of the msoAutoShape available in
Powerpoint on the screen, and the reference for a large (but not complete) list
are in Microsoft reference page.
The shapes used by MacroPlot are msoShapeOval msoShapeRectangle msoShapeDiamond msoShapeIsoscelesTriangle and msoShapePie
- Sub ALn(x1, y1, x2, y2) adds a line on the slide from x1 y1 to x2 y2.
Characteristics of the line is as defined in module level variables.
- Sub DTx(ort, hA, vA, x, y, txt) draws a text string on the slide.
- ort is orientation, 0 for horizontal and 1 vertical.
- hA is horizontal alignment, 0 on the left, 1 middle, and 2 right.
- vA is vertical alignment, 0 top, 1 middle, and 2 bottom.
- x and y the coordinate the text is aligned to.
- txt is the text to draw.
- Font characteristics are as defined by module level variables.
- Sub DWg(l,t,w,h,a1,a2) draws a pie on the slide, and is used to draw pie charts.
- l and t are left and top of the circle of which the pie is a part,
- w and h are width and height of that circle and should be the same in a circular pie.
- a1 and a2 are angles (in degrees) of the start and end of the pie.
- Line and fill characteristics are as defined by module level variables.
- sub DoPlot() is the main or controlling subroutine at the beginning of the
editing box. It sets the default parameters represented by the module level variables.
- For lines, it sets line thickness to 1, color to black, and type solid.
- For font it sets name to Verdana, size to 18, color to black, and type to normal.
- For fill it sets color to white and transparent.
- The remainder of this subroutine consists of resetting the parameters, and calling one of the
4 drawing subroutines. The exceptions are curves, polynomial and normal, where the curve is drawn
as a series of short lines, the coordinates of which are calculated on the run.
Links to useful VBA references
Getting Started with VBA in Office
PowerPoint Object Model Reference
MsoAutoShapeType Enumeration
|