Related Links:
MacroPlot Help Page
MacroPlot Program Page
Pie Chart Program Page
Bar Plot Program Page
Forest Plot Program Page
Scatter Plot Program Page
Count Table Plot Program Page
Group Data Plot Program Page
Normal Distribution Plot Program Page
MacroPlot
Pie Chart
Bar Plot
Forest Plot
Scatter Plot
Count Table Plot
Group Data Plot
Normal Distribution Plot
Results from statistical calculations often include display of graphics, and when required, programs from StatToolsalso display graphics as part of the results. Explanations for these graphical outputs are usually included in the explanation
of the statistical procedure involved.
There are however stand-alone graphical programs, using the MacroPlot system, and they are explained in their panels within this page.
The MacroPlot Help Page
provides detailed explanations on how MacroPlot works, and templates for all
MacroPlot commands. Users who wish to use MacroPlot as their graphical utility should familiarize themselves with this
help file.
The MacroPlot Program Page
is a general purpose graphic editor. It contains a text area for users to
enter their own MacroPlot Commands to create whatever graphic within MacroPlot's capabilities. The text box contains
random MacroPlot codes as examples for the user.
Data input for the Pie Chart Program Page
consists of a single column of values
MacroPlot Code Generation
- The program converts the number in each row to a percent of the total
- The percent is converted into wedges in a pie, so that 360 degrees forms the total of 100%
- The wedges starts at 3 O'clock and proceeds clockwise
- The fill color for each edge are random numbers generated on the run, so that each run will produce a different
set of colors. Users may choose to edit the colors. Color codes to assist in this process is available in
the MacroPlot Help Page
- The MacroPlot codes are placed in a text box, to allow further editing and replotting by the user
- The bitmap is produced. according to the MacroPlot codes
- The MacroPlot codes are further translated into VBA codes, which can be imported as macros to a Powerpoint
file to create Vector graphic.
Explanation of the example codes : explanations in maroon
Bitmap Initialise 420 300 255 255 255 255
Creates a bitmap 420 pixels wide x 300 pixels high, white background
Line Thick 2
Lines 2 pixels wide
Font Style 1
Text in bold
Fill Color 238 215 40 255
Color of first wedge using red green blue, each a random number 0-255, α=255(opaque)
Bitmap Wedge 125 125 105 0 0 187
A wedge, center(x=125, y=125), radius=105, centrifuged (0 pixels), angles (0-187 degs)
Bitmap Square 5 250 8
A square, radius=5 pixels, center(x=250, y=8)
Bitmap HText 0 1 260 8 52.00%
Text="52.00%", Align (horizontal : 0=left, vertical : 1=center), position (x=260 y=8)
The rest of the codes are repeat of other wedges with different color and in different position
Fill Color 172 234 172 255
Bitmap Wedge 125 125 105 0 187 255
Bitmap Square 5 250 24
Bitmap HText 0 1 260 24 18.99%
Fill Color 47 2 67 255
Bitmap Wedge 125 125 105 0 255 270
Bitmap Square 5 250 40
Bitmap HText 0 1 260 40 4.01%
Fill Color 80 143 114 255
Bitmap Wedge 125 125 105 0 270 360
Bitmap Square 5 250 56
Bitmap HText 0 1 260 56 25.00%
Vertical Bar Plots : This is the most common type of bar plots, where the y axis represents percent or values,
for different groups identified by the x axis.
- The data input for the Bar Plot Program Page
is a table with 2 columns.
- Column 1 is the x value, representing where the bar will be placed
- Column 2 the y value, representing how tall the bar will be
- There are two arrangements for vertical bar plots.
- X axis contains labels : In this arrangement, the groups on the x axis, be they text or numbers are labels, and the bars are
evenly spaced. This plot is therefore identical to the one produced by Excel. For example, if the x values for the
bars are 1, 1.5, 3, and 4, then the bars are separated with equal distances, the distance between bars for 1 and 1.5
is the same as that for 1.5 and 3, also that between 3 and 4
Column 1 is process as text. It must be a single word with no gaps. If a gap is required, it should be represented by
the underscore _. Column 2 must be a number
- X axis contains measurements : In this measurement, the x axis is a numerical scale, and the distances between the bars
depends on their numerical value. For example, if the x values for the bars are 1, 1.5, 3, and 4, then the distance
between the bars for 1 and 1.5 (1.5-1=0.5) is narrower than that between 3 and 4 (4-3=1.0), which is narrower than
between 1.5 and 3 (3-1.5=1.5)
Both columns 1 and 2 must be numbers
Horizontal Bar Plots : This is conceptually the same as the vertical bar plot, except the bars are horizontal
The data is a table with 2 columns.
- Column 1 is the x value, representing how long the bar will be from the left
- Column 2 the y value, representing where the bar will be placed
- Both x and y values must be numbers
MacroPlot Code Generation
- The program estimates minimum and maximum values for x and y, and creates an inner plotting area
- Intervals and labels are marked according to minimum and maximum values. These provides some idea of where the
values are, but usually not suitable for publication. Users should edit the labels and scaling in the MacroPlot codes, and
re-creates the more publishable plot.
- The bars are painted into the plotting area. Again, users may wish to edit the width and colors of the bars
Explanation of the example codes : explanations in maroon
- Plotting area, scaling and labelling. Please note that the numerical parameters will need editing
Bitmap Initialise 700 500 255 255 255 255
Creates a bitmap 7000 pixels wide x 500 pixels high, white background
Line Thick 2
Lines 2 pixels wide
Font Style 1
Text in bold
Plot Values 0 5.25 9.5 0.75
Set range of values in the plotting area, x=0 to 9.5, y=0.75 to 5.25
Plot XAxis 0.75 0 0.5 0 1.0
Place x axis at y=0.75, mark from 0 at 0.5 interval, scale from 0 at 1.0 interval
Plot YAxis 0 0.75 0.2 0.75 0.4
Place y axis at x=0, mark from 0.75 at 0.2 interval, scale from 0.75 at 0.4 interval
Plot XLabel x 20
Place the label "x" 20 pixels below the bottom of the plotting area
Plot YLabel y 30
Place the label "y" 30 pixels to the left of the plotting area
- Vertical Bars
Plot VBar 15 2 0 213
Place a vertical bar, 31 (2x15+1) pixels wide, at from y=0 to y=213, where x=2
Plot HText 1 0 3 0 CS 0 2
Text="CS", Align (horizontal : 1=center, vertical : 0=top), position (x=3 y=0), then
shift the text 0 pixels horizontally and 2 (+=downwards) pixels vertically. In other words, place "CS"
centered the text at x=3 and the top of text 2 pixels below where y=0
- Horizontal Bars
Plot HBar 15 0 5 1
Place a horizontal bar, 31 (2x15+1) pixels tall, from x=0 to x=5, where y = 1
Forest plots, as in the Forest Plot Program Page
are commonly used for the comparison of effect sizes
and their confidence intervals, particularly in meta-analysis, where the results of individual studies and their
combinations can be displayed in an easily interpretable plot.
Two scaling options are available
- Normal scaling assumes normally distributed values, with a null value of zero 0
- Logarithmic scaling is for the log-normally distributed variables such as ratios, with a null value of one (1). All data
in a logarithmically scaled plot must be >0, or the program will crash.
Data Input : The data is a table with 3 columns, separated by spaces or tabs
- Each row is data from a set of effect size
- Column 1 is the central value, usually the mean
- Column 2 and 3 are values for the limits of the confidence interval
MacroPlot Code Generation
- Program estimates the range of the x axis, and produce the inner plotting area
- Program then scales the x axis
- For normal scaling, the markings and scaling are from the central 0 value outwards
- For logarithmic scaling, the program produces a logarithmic scaling in multiples of 10s
- Program places each set of effect size, in order from top downwards. The central value represented by a
circular dot, and the confidence interval as a line.
Explanation of the example codes : explanations in maroon
- Plotting area, scaling and labelling. Please note that the numerical parameters will need editing
Bitmap Initialise 300 420 255 255 255 255
Creates a bitmap 300 pixels wide x 420 pixels high, white background
Plot Pixels 45 21 255 357
Defines the plotting area as 45 and 255 pixels from the left, 21 and 357 pixels from the top
Line Thick 2
Lines 2 pixels wide
Font Style 1
Text in bold
Plot XLabel Forest_Plot 20
Place the label "Forest Plot" 20 pixels below the plotting area. The label can be edited
Normal Scaling
Plot Values -0.1875 -1 0.2188 7
Defines the ranges : x from -0.1875 to 0.2188, and y from -1 to 7
Plot XAxis 7 0 0.03 0 0.06
From zero (0) outwards, at y=7, mark every 0.03 and scale every 0.06. The values require editing
Plot XAxis 7 0 -0.03 -0.06 -0.06
From zero (0) outwards, at y=7, mark every -0.03 and scale every -0.06. The values require editing
Plot Line 0 -1 0 7
Draw the line for null, at x=0, from y=-1 to y=7
Logarithmic scaling
Plot Values 0.1000 -1 10 7
Defines the ranges : x from 0.1000 to 10, and y from -1 to 7
Plot XLog
Defines the x axis is logarithmically scaled
Plot XAxisLog 7
Mark and scale the x axis, logarithmically, in multiples of 10
Plot Line 1 -1 1 7
Draw the line for null, at x=1, from y=-1 to y=7
- Draw the effect size
Fill Color 0 0 0 255
Set the fill color to black and opaque, for the circular dots
Line Thick 4
Set the line thickness to 4 pixels, for the confidence intervals
Plot Line 0.69 1 2.02 1
Draw a line from x=0.69 to x=2.02, where y=1, to mark the confidence interval
Plot Circle 5 1.18 1
Draw a circular dot with 5 pixels radius, where x=1.18 and y=1, to mark the mean
Scatter plot, as in the Scatter Plot Program Page
is a two dimensional plot which displays the relationship
between the x and y value of each data point. Although this is a very common plot, it is mainly used as a background to
display other statistical results.
Although the Scatter Plot Program Page
provides 4 options for scatter plot, they are merely different ways of
scaling for the two axis, while data input the main plotting algorithm remains the same. The only thing to remember is
that values for any logarithmic calculations must be >0, or the program will crash.
Data Input : The data is a table with 2 columns, separated by spaces or tabs
- Each row is data from a subject to be plotted
- Column 1 is the x value
- Column 2 is the y value
Dot size :
- The size of the dot representing each data point has a diameter of 2 x dotsize + 1. The default radius is 5, making the dot 11 pixels in diameter
- If dotsize is <=0, then a single pixel will be plotted
MacroPlot Code Generation
- Program estimates the range of the x and y variables, and depending on normal or logarithmic scales, produce the inner plotting area
- Program then scales the two axis
- For normal scaling, the markings are approximately 1/10 of the range, and scaling are approximately 1/5 of the range
- For logarithmic scaling, the program produces a logarithmic scaling in multiples of 10s
- Program places each data point as a circular dot on the plot. The default is black circular dots, but these can be
edited by the user.
Explanation of the example codes : explanations in maroon
- Plotting area, scaling and labelling. Please note that the numerical parameters will need editing
Bitmap Initialise 700 500 255 255 255 255
Creates a bitmap 700 pixels wide x 500 pixels high, white background
Plot Values 34.5 3625 41.5 2374
Set the range of values, x from 34.5 to 41.5, y from 2374 to 3625
Line Thick 2
Lines 2 pixels wide
Font Style 1
Text in bold
Plot XLabel X_Values 20
Place the label "X Values" 20 pixels below the plotting area. The label can be edited
Plot YLabel Y_Values 55
Place the label "Y Values" 50 pixels to the left of the plotting area. The label can be edited
Normal Scaling
Plot XAxis 2374 34.5 0.5 34.5 1.0
Place x axis at y=2374, mark from 34.5 at 0.5 intervals, scale from 34.5 at 1.0 intervals.
The values require editing
Plot YAxis 34.5 2374 125 2374 250
Place y axis at x=34.5, mark from 2374 at 125 intervals, scale from 2374 at 250 intervals.
The values require editing
Logarithmic scaling
Plot Values 10 10000 100 1000
Defines the ranges : x from 10 to 100, and y from 1000 to 10000
Plot XLog
Defines the x axis is logarithmically scaled
Plot XAxisLog 1000
Placed the x axis where y=1000. Mark and scale the x axis, logarithmically, in multiples of 10
Plot YLog
Defines the y axis is logarithmically scaled
Plot YAxisLog 10
Placed the y axis where x=10. Mark and scale the y axis, logarithmically, in multiples of 10
- Draw the dot
The Count Table Plot was created to produce a plot of a contingency table of counts, to allow an immediate visualisation and precise estimate of the sample size in each of the cells.
The program Count Table Plot Program Page
provides the following
- The input is a table of counts, each row must have the same number of columns. Empty cells must have 0 as count
- The size of the dot can be set, usually depending on the size of the table (rows and columns) and the maximum count in any
of the cells
- Two styles of output is available
Style 1 represents each cell as a circle, the size of which depends on the sample size in the cell. The sample size itself
will also be displayed.
- The minimum diameter of the circle is 10 pixels, to accomodate the sample size display
- The diameter d of the circle is calculated as
- If the smallest sample size of the table is nsmallest
- If the radius of the circle for the smallest sample size is dsmallest
- If the sample size under consideration is ncurrent
- The the diameter for the current circle dcurrent = sqrt(dsmallest2 x
ncurrent / nsmallest)
Style 2 represents each count in a cell as a cluster of circles, the number of which is the same as the count in the cell.
- The diameter of the circles can be set. The default is 5 pixels.
- Larger circles can be used when there are few cells in the table and the maximum count in any cell are few
- If a diameter of 0 is set, each circle is represented by a single pixel.
SPSS produce an excellent plot showing 95% confidence interval of the data and 95% confidence interval of the mean. Group data plot from the Group Data Plot Program Page
is an attempt to duplicate and perhaps improve upon this. It has the following features.
- It marks out the 95% confidence intervals of data and mean, as produced by SPSS
- It plots all the data points for each group
- Where there are more than one case with the same value in a group, the data points are spread out, so that the density of the
data at any level can be visualized.
Data Input : The data is a table with two columns, separated by spaces or tabs
- Each row is data from a case
- Column 1 is the label for the group on the x axis. The label is a single word with no gaps. If a gap is required,
it should be represented by an underscore _central value, usually the mean
- Column 2 is the value to be plotted on the y axis
Dot size :
- The size of the dot representing each data point has a diameter of 2 x dotsize + 1. The default radius is 5, making the dot 11 pixels in diameter
- If dotsize is <=0, then a single pixel will be plotted
- if dotsize<0 is used then the number of pixels for a particular value is 1 + log1.05n, where n is the number of data points for that value. This is introduced to reduce the spread of the plot when there are numerous data points for any value. The down side is that the plot is only approximate
MacroPlot Code Generation
- Program estimates the range of the x and number of groups, and produce the inner plotting area
- Program plots data value for each group. Where there are more than one case in a group, the data plot is shifted
horizontally so that they can be seen.
- For each group, program
- Marks the mean with a horizontal line
- Marks the 95% confidence interval of measurements with a vertical line
- Marks the 95% confidence interval of the mean with a box
- Program produces a table, listing sample size (n), mean, Standard Deviation, Standard Error of the mean, and their
95% confidence intervals, for each group.
Explanation of the example codes : explanations in maroon
- Plotting area, scaling and labelling. Please note that the numerical parameters will need editing
Bitmap Initialise 700 500 255 255 255 255
Creates a bitmap 700 pixels wide x 500 pixels high, white background
Line Thick 2
Lines 2 pixels wide
Font Style 1
Text in bold
Plot Values -1 4096 2 2047
Set the range of values, x from -1 to 2 ( as the two groups are numerically designated 0 and 1),
y from 2047 to 4096
Plot XAxis 2047 0 1 -2 -1
Place the x axis where y=2047, marks the x axis at 0 and 1. The scales are deliberately given
out of range values so they are not produced, as each group is labelled by text
Plot HText 1 0 0 2047 Boy 0 5
Place the text "Boy", horizontally aligned (1=center), vertically aligned (0=top), where x=0 and y=2047,
then shift the text 0 pixels horizontally and 5 pixels downwards. In other words label group 0 as "Boy" 5 pixels below
the plotting area.
Plot HText 1 0 1 2047 Girl 0 5
Place the text "Girl", horizontally aligned (1=center), vertically aligned (0=top), where x=1 and y=2047,
then shift the text 0 pixels horizontally and 5 pixels downwards. In other words label group 1 as "Girl" 5 pixels below
the plotting area.
Plot XLabel Groups 25
Place the label "Groups" 25 pixels below the plotting area. The label can be edited
Plot YLabel Values 55
Place the label "Values" 55 pixels to the left of the plotting area. The label can be edited
- Plotting data points
Fill Color 255 255 255 0
assign fill color black and opaque for the circular dots
Plot Circle 5 1 3067
Place a circular dot, 5 pixels in radius, where x = 1 and y = 3067
Plot Circle 5 1 3067 10 0
Place a circular dot, 5 pixels in radius, where x = 1 and y = 3067,then shift the dot 10 pixels
to the right, 0 pixels up and down
Plot Circle 5 1 3067 -10 0
Place a circular dot, 5 pixels in radius, where x = 1 and y = 3067,then shift the dot 10 pixels
to the left, 0 pixels up and down
The normal distribution plot compares a set of data against a theoretical normal distribution plot. It therefore allows a
visual inspection of the distribution of the data. The plot was created initially to service the
Numerical Transformation Program Page
, as it allows a visualisation of the distribution before and after transformation.
The algorithm was tidied up to be used more formally in the Normal Distribution Plot Program Page
Data and parameters Input :
- The data is a single column of values to be plotted
- Reference Mean and Reference Standard Deviation are nominated value by which the data will be grouped and plotted.
If no reference is available, the value of 0 can be used for Standard Deviation, and the program will use the mean and
Standard Deviation calculated from the data itself.
- Size of grouping can be the following options
- By 1 Standard Deviation, one centrally (from -0.5 to 0.5 SD), and 4 (each of 1 SD) on each side, a total of 9 groups
- By 0.5 Standard Deviation, one centrally (from -0.25 to 0.25 SD), and 8 (each of 0.5 SD) on each side, a total of 17 groups
- By 0.25 Standard Deviation, one centrally (from -0.125 to 0.125 SD), and 16 (each of 0.25 SD) on each side, a total of 33 groups
- By 0.125 Standard Deviation, one centrally (from -0.0625 to 0.0625 SD), and 32 (each of 0.125 SD) on each side, a total
of 65 groups
MacroPlot Code Generation
- Program converts values into Standard Deviation units (z = (value-mean) / SD), and place the case in the appropriate
group from -4SD to +4SD. Values more extreme than 4 SDs away from the mean are placed in the end group.
- The number of cases in each group is converted to a percent of the total for plotting.
- Empty groups are eliminated, the rest are displayed.
- The groups, numbers, and percent are displayed in a table.
- The groups and their percentage are displayed in a vertical bar plot.
- A normal distribution curve, with the designated mean and Standard Deviation, is superimposed upon the bar plot.
Plotting area, scaling and labelling. Please note that the numerical parameters will need editing
All the code except one are the same as those for the vertical bar plot, and will not be
explained here.
Plot Normal 0.0 1.0 38.2925
Draws a normal distribution curve from -4SD to +4SD, using the designated mean and Standard Deviation,
with a maximum height of 39.2925%
Please Note : the maximum height (central group around mean) of normal distribution curves, in percent(%) are as follows
Size of grouping | Height of central group (%) |
1 SD | 38.2925 |
0.5 SD | 19.7413 |
0.25 SD | 9.9476 |
0.125 SD | 4.9835 |
|