PEN directive

Defines the properties of “pens” for high-resolution graphics.


RESET = string token Whether to reset the pen definitions to their default values (yes, no); default no
BOXUNITS = string token Units to use for text boxes (characters, distance); the default is to retain the existing setting


NUMBER = scalars Numbers associated with the pens
COLOUR = texts or scalars Colour to use with each pen unless otherwise specified by the CSYMBOL, CLINE, CFILL or CAREA parameters
LINESTYLE = texts or scalars Style for line used by each pen when joining points
METHOD = string tokens Method for determining line (point, line, monotonic, closed, open, fill, spline, polygon)
SYMBOL = texts, scalars, pointers or matrices Defines the plotting symbol for each pen, by a text or scalar for a pre-defined symbol, a pointer for a user-defined symbol, or a matrix to supply a bitmap
LABELS = texts or factors Define labels that will be printed alongside the plotting symbols
ROTATION = scalars or variates Rotation required for the plotting symbols and labels (in degrees)
JOIN = string tokens Order in which points are to be joined by each pen (ascending, given)
BRUSH = scalars Number of the type of area filling used with each pen when drawing pie charts or histograms
FONT = texts or scalars Font to be used for any text written by each pen
THICKNESS = scalars Thickness with which any lines are drawn by each pen
SIZEMULTIPLIER = scalars or variates Multiplier used in the calculation of the size in which to draw symbols and labels by each pen unless otherwise specified by SMSYMBOL or SMLABEL
CSYMBOL = texts or scalars Colour to use with each pen when drawing symbols
CLINE = texts or scalars Colour to use with each pen when drawing lines
CFILL = texts or scalars Colour to use with each pen when filling areas inside hollow symbols
CAREA = texts or scalars Colour to use with each pen when filling areas inside polygons and bars of histograms
SMSYMBOL = scalars or variates Multiplier used in the calculation of the size in which to draw symbols by each pen
SMLABEL = scalars or variates Multiplier used in the calculation of the size in which to draw labels by each pen
DFSPLINE = scalars Number of degrees of freedom to use when METHOD=spline
YMISSING = string token How to treat missing y-values when METHOD=spline (break, interpolate)
XMISSING = string token How to treat missing x-values when METHOD=spline (break, ignore)
YLPOSITION = string token How to position labels in the y-direction with respect to the points (above, centre, below, automatic)
XLPOSITION = string token How to position labels in the x-direction with respect to the points (left, centre, right, automatic)
YLSIZE = scalars or variates Sizes of the y-direction of the text boxes into which to plot labels
XLSIZE = scalars or variates Sizes of the x-direction of the text boxes
YLOFFSET = scalars or variates Offsets in the y-direction of the text boxes
XLOFFSET = scalars or variates Offsets in the x-direction of the text boxes
BARTHICKNESS = scalars Thickness with which any error bars are drawn by each pen
BARCAPWIDTH = scalars Width of the cap drawn by each pen at the top and bottom of any error bars
DESCRIPTION = texts Description for points plotted by the pen, to be used by the Data Information tool in the Graphics Viewer
TSYMBOL = scalars Defines the transparency of symbols drawn by each pen, on a scale of 0 (opaque) to 255 (completely transparent)
TLINE = scalars Defines the transparency of lines drawn by each pen
TFILL = scalars Defines the transparency to use when filling areas inside hollow symbols with each pen
TAREA = scalars Defines the transparency to use when filling areas inside polygons and bars of histograms with each pen
SAVE = pointers Saves details of the current settings for the pen concerned


Graphical displays are drawn using graphical pens. The graphics commands each have particular pens that they use by default, but most allow you to specify alternatives (see DGRAPH, D3GRAPH, DCONTOUR, DHISTOGRAM etc). The attributes of the pens, such as colour, font and symbol-type, determine how the plots are generated. The PEN directive allows you to change these attributes, so that you can modify the resulting display. Different attributes are relevant for different types of plot: for example symbols and labels are used only within DGRAPH and D3GRAPH (and the graphics procedures that use them to construct their plots).

The NUMBER parameter lists the numbers of the pens, in the range 1 to 256 or -1 to -12, that you wish to redefine. By default, any aspects of these pens that are not set explicitly retain the values that they had immediately before the PEN statement. Alternatively, you can specify option RESET=yes to reset their definitions to the default values defined by Genstat at the start of each job.

Pens 1 to 256 are used for the information that is plotted in a graph (points, lines, and so on). In most of the graphics commands, the default is to use these pens in succession for the different structures that are plotted, so that the various data sets can easily be distinguished. The negatively numbered pens are used as the initial defaults for the axes and their associated marks and labels (see XAXIS), or for gridlines, overall title and key (see FRAME), or for default gridlines in shade plots (see DSHADE), or for default outlines in histograms, bar charts and pie charts (see DHISTOGRAM, BARCHART and DPIE), or for error bars (see BARCHART), or for the overall title (see DSTART). Details are given in the Methods Section below. They cannot be used for any other purposes.

The COLOUR, CSYMBOL, CLINE, CFILL and CAREA parameters specify the colours to be used by the pen. The COLOUR parameter defines the colour for everything plotted by the pen, while the other parameters define specific aspects (overriding any setting of COLOUR): CSYMBOL defines the colour to be used for drawing symbols, CLINE defines the colour for lines, CFILL defines the colour for filling areas inside “hollow” symbols like circles, and CAREA defines the colour for filling areas inside polygons and bars of histograms. The parameters can be set either to a text containing the name of one of Genstat’s pre-defined colours, or to a scalar containing a number defining a colour using the RGB system, or to a hexadecimal digit defined in a string of the form '#abc', '0xabc' or '0Xabc' where abc is the hexadecimal digit. You can use the RGB function to construct these colour numbers from their red, green and blue components: for example

CALCULATE xgold = RGB(255; 215; 0)

PEN 2; CSYMBOL=xgold

sets xgold to the colour gold (which has red, green and blue values 255, 215 and 0 respectively), and uses this as the colour for symbols drawn by pen 2. The numbers give you access to the complete spectrum supported by most colour graphics devices. (Note, though, that the colours are mapped automatically onto a grey scale if the device is defined with a grey-scale palette; see DEVICE). Alternatively, the pre-defined colours define the standard colours used by many web browsers, and mainly use the same names. The names, and their corresponding red, green and blue values, are listed in Methods section. They can be given in either upper or lower case, or in any mixture, but they must not be abbreviated.

The TSYMBOL, TLINE, TFILL and TAREA parameters accompany the parameters CSYMBOL, CLINE, CFILL and CAREA, respectively, and define the transparency of the corresponding colours. Their values can range from 0 (opaque) to 255 (completely transparent). The pens all have initial defaults of 0 for the transparencies.

The SYMBOL parameter defines the symbol that is drawn at each point, for example by DGRAPH. You can mark different points with different symbols (for example to indicate groupings in the data) by setting the PEN parameter of DGRAPH to a variate or factor specifying a pen with the appropriate symbol for each point.

Genstat provides a choice of standard symbols, listed below, that can be specified either by giving the name (in a text with a single value), or the number (in a scalar).

1    'Cross'

2    'Circle'

3    'Plus'

4    'Star'

5    'Square'

6    'Diamond'

7    'Triangle'

8    'Nabla'

9    'Asterisk'

10  'Minus'

11  'Heavyminus'

12  'Heavyplus'

13  'Heavycross'

14  'Smallcircle'

15  'Tinycircle'

16  'Female'

17  'Male'

18  'Rhombus

19  'Circlecross

20  'Circleplus'

21  'Squarecross'

22  'Squareplus'

-1   'Sphere'

-2   'Cone'

-3   'Cylinder

-4   ‘Cube’

The final four symbols (numbered -1 to -4) are intended mainly for 3-dimensional plots, and may not be available on some devices. You can set SYMBOL='none' or SYMBOL=0 if you do not want to plot symbols at the data points, as for example if you only want to draw a line through the points. You can also use SYMBOL=0 together with the LABELS parameter (described below) to plot a character at the data points instead of a symbol. For example

PEN 1; SYMBOL='none'; LABEL='A'



will identify the points plotted by pen 1 with the letter A.

To define a symbol of your own, you can set SYMBOL to a pointer containing a pair of variates defining the coordinates of a set of points to be joined by straight line segments. The points should be within a notional square with bounds -1.0 to 1.0 in each direction. The square is centred on the data point, and scaled to the same size as the standard symbols. Missing values can be included in the coordinates, to use separate pen strokes to draw the line segments. The final possibility is to set SYMBOL to a matrix of RGB colour values, representing a bitmap.

The LABELS parameter allows you to label each point with a string or number. You can set it to a text structure to specify strings to be plotted at each point. If the text has a single string, this will be be plotted at every point; otherwise the text must have the same number of values as the Y and X variates that are to be plotted. You can also set LABELS to a factor. If the factor has labels, then these are used; otherwise the points are labelled by its levels. This provides another way of representing grouped data.

The positioning of the labels with respect to the points is controlled by the YLPOSITION and XLPOSITION parameters. The initial default is to determine the positions automatically according to their type (e.g. labels for points, or for tick marks on the y-axis, or on the x-axis, and so on). The labels are plotted into text boxes whose widths in the x- and y-directions can be defined by the YLSIZE and XLSIZE parameters; if these are not set, the boxes are defined to plot the labels as a single line of characters. The amounts by which the boxes are offset in the the x- and y-directions can be defined by the YLOFFSET and XLOFFSET parameters; if these are not set, the positions of the boxes are defined automatically as appropriate for the positions defined by the YLPOSITION and XLPOSITION parameters. The BOXUNITS option defines what units to use when defining the sizes and positions of the text boxes. The initial default is to measure these in numbers of characters of an average width in the defined font and size (see parameters FONT and SMLABEL), but you can set option BOXUNITS=distance to use the distances as defined by the axes of the graph.

The graphical symbols are drawn so that they are centred at the specified position. If LABELS are specified they are aligned alongside the markers, unless you have set SYMBOL=0 to suppress the markers, in which case the labels start from the specified (x,y) position. For compatibility with previous releases of Genstat you can also set SYMBOL to a factor, which has the same effect as setting LABELS with SYMBOL=0.

The Genstat Graphics Viewer with Genstat for Windows has a “Data Information” tool that allows you to display information about each point when you place the cursor over the point. If you want to replace the default information, you can set the DESCRIPTION parameter to a text (with one line for each point) containing your own information.

The METHOD parameter specifies the type of object to be plotted: points, lines or filled polygons. The initial default for every pen, METHOD=point, will result in points being plotted using the corresponding symbols, labels, colours and fonts. Various types of line can be drawn through the plotted points; either straight lines (line and polygon) or smooth curves (monotonic, open, closed and spline). The line and polygon settings differ in that, with polygon, a line is drawn also to connect the first and last points. The monotonic setting specifies that a smooth single-valued curve is to be drawn through the data points. The name is derived from the requirement that the x-values (rather than the fitted curve) must be strictly monotonic, so that there is only one y-value for each distinct x-value. To ensure this, a copy of the data is made and sorted before the curve is fitted. This setting is recommended for plotting curves fitted to data, for example with FITCURVE. You should ensure that the points are close enough for the plotted line to be a reasonable approximation. When you know the functional form of the curve, it may be advantageous to calculate extra points. The open and closed settings specify that a smooth, possibly multi-valued, curve is to be drawn through the data points, using the method of McConalogue (1970); the resulting curve is rotationally invariant, although it is not invariant under scaling. The closed setting connects the last point to the first. McConalogue’s method (open or closed) is more suited to the situation where the plotted curve is intended to represent the shape of an object. Alternatively, the spline setting plots a smoothing spline fitted through the points. The DFSPLINE parameter specifies how many degrees of freedom to use in the spline (initial default 4). The YMISSING parameter controls whether to break the spline at a missing y-value or to interpolate y-value, and the XMISSING parameter controls whether to break the spline at a missing x-value or to ignore the point; the initial default for both parameters is to break the spline. The setting METHOD=fill joins the data points by straight lines to produce one or more polygons. Each polygon is then shaded in the style specified by BRUSH (see below). The plotting method also determines how contours will be drawn. Also, the combination of SYMBOL=0 and METHOD=point will produce no plotting at all (and no warning) within DGRAPH.

If the requested plotting method produces a line through the points, the LINESTYLE parameter will specify what sort of line is drawn (for example a solid, dotted or dashed line). The type of style can be specified either by giving the name (in a text with a single value), or the number (in a scalar).

1    'Solid'

2    'Dot' or '.'

3    'Dash' or '-'

4    'Dotdash' or '.-'

5    'Tightdash' or 'T-'

6    'Longdash' or 'L-'

7    'Shortdash' or 'S-'

8    'Closedot' or 'C-'

9    'Finedot' or 'F.'

10  'Doubledotdash' or '..-'

Each text can all be abbreviated to the minimum number of characters required to distinguish it from the earlier styles.

The JOIN parameter controls the order in which points are connected when lines are to be drawn or the points define a polygon to be shaded. Given requests that the data are to be plotted in the order in which they are stored, whereas ascending implies that the data are copied and sorted so that the x-values are in ascending order before plotting. This parameter is ignored when METHOD=monotonic, as this requires that the data must always be sorted.

The BRUSH parameter controls how areas are shaded when METHOD is set to fill, or when plotting histograms and pie charts. There are 16 available patterns indicated by the integers 1 to 16. In general, the higher the number, the denser the hatching, and the longer such areas take to plot. The device-specific brush styles are generally faster, and produce smaller output files; however results are not guaranteed to be the same on every type of device. The CFILL parameter defines which colour is used by the pen to fill the areas.

The THICKNESS parameter allows you to specify an amount by which the standard thickness of plotted lines is to be multiplied. This allows you to increase the thickness of lines, perhaps to highlight some feature of a plot. You can also use thickness to emphasize the axes, by redefining the appropriate pen. For some devices, it is not possible to control the thickness of plotted lines; the THICKNESS parameter is then ignored. Similarly, the BARTHICKNESS parameter can provide a multiplier for the line thickness when the pen is used to draw an error bar, and the BARCAPWIDTH parameter can give a multiplier to adjust the standard width of the lines at the top and bottom of error bars.

The default sizes of symbols and the characters in labels are determined from the dimensions of the current window. The SIZEMULTIPLIER parameter can be used to modify the sizes of both of these, by specifying a value by which this default size is to be multiplied. Alternatively, you can use the SMSYMBOL parameter to modify just the symbol size, or the SMLABEL parameter to modify just the size of characters in labels. For example when plotting a graph in a small window you may wish to increase the size of annotation in order to make it legible. They can each be set to a scalar, or to a variate to allow the different points to be scaled in different ways.

The ROTATION parameter controls the angle (in degrees) at which to plot text or user-defined symbols. The initial setting of zero will produce text “conventionally” orientated. You can set ROTATION to a scalar value that will apply to all points, or to a variate that allows a different angle to be used at each point.

The FONT parameter defines the font family to be used by each pen to plot textual information, for example, in titles, axis annotation, plotting symbols and keys. This can be set to a text containing the name of a font family, or to a scalar containing an integer between 1 and 25. The initial default for each pen is to use the default graphics font, which can be defined either by using menus in the Genstat Client or Graphics Viewer, or by using the DFONT directive. You can find out the names of the fonts, available to specify in a text, by looking at any of the controls for specifying fonts in the Client or Graphics Viewer. The integers refer to fonts that should always be available. You can list these using the DHELP procedure. Font 1 has a special status, in that it automatically maps to the currently-defined default graphics font. If you change the default graphics font, this will be used as the default font in any graphs that are then displayed or redisplayed, including those that have been stored in Genstat graphics meta files (i.e. files with the gmf suffix). If you specify a font that is unavailable on your computer, the default font is used instead.

The current settings of each pen can be saved in a pointer supplied by the SAVE parameter. The elements of the pointer are labelled to identify the components. Initial default settings are represented by missing values; the actual values used for these attributes when plotting will depend on the output device.




The names of the standard pre-defined colours are listed below with their corresponding red, green and blue values for use e.g. in the RGB function.

Red colors

IndianRed RGB(205; 92; 92)
LightCoral RGB(240; 128; 128)
Salmon RGB(250; 128; 114)
DarkSalmon RGB(233; 150; 122)
LightSalmon RGB(255; 160; 122)
Crimson RGB(220; 20; 60)
Red RGB(255; 0; 0)
FireBrick RGB(178; 34; 34)
DarkRed RGB(139; 0; 0)

Pink colors

Pink RGB(255; 192; 203)
LightPink RGB(255; 182; 193)
HotPink RGB(255; 105; 180)
DeepPink RGB(255; 20; 147)
MediumVioletRed RGB(199; 21; 133)
PaleVioletRed RGB(219; 112; 147)

Orange colors

LightSalmon RGB(255; 160; 122)
Coral RGB(255; 127; 80)
Tomato RGB(255; 99; 71)
OrangeRed RGB(255; 69; 0)
DarkOrange RGB(255; 140; 0)
Orange RGB(255; 165; 0)

Yellow colors

Gold RGB(255; 215; 0)
Yellow RGB(255; 255; 0)
LightYellow RGB(255; 255; 224)
LemonChiffon RGB(255; 250; 205)
LightGoldenrodYellow RGB(250; 250; 210)
PapayaWhip RGB(255; 239; 213)
Moccasin RGB(255; 228; 181)
PeachPuff RGB(255; 218; 185)
PaleGoldenrod RGB(238; 232; 170)
Khaki RGB(240; 230; 140)
DarkKhaki RGB(189; 183; 107)

Purple colors

Lavender RGB(230; 230; 250)
Thistle RGB(216; 191; 216)
Plum RGB(221; 160; 221)
Violet RGB(238; 130; 238)
Orchid RGB(218; 112; 214)
Fuchsia RGB(255; 0; 255)
Magenta RGB(255; 0; 255)
MediumOrchid RGB(186; 85; 211)
MediumPurple RGB(147; 112; 219)
BlueViolet RGB(138; 43; 226)
DarkViolet RGB(148; 0; 211)
DarkOrchid RGB(153; 50; 204)
DarkMagenta RGB(139; 0; 139)
Purple RGB(128; 0; 128)
Indigo RGB( 75; 0; 130)
SlateBlue RGB(106; 90; 205)
DarkSlateBlue RGB( 72; 61; 139)

Green colors

GreenYellow RGB(173; 255; 47)
Chartreuse RGB(127; 255; 0)
LawnGreen RGB(124; 252; 0)
Lime RGB( 0; 255; 0)
LimeGreen RGB( 50; 205; 50)
PaleGreen RGB(152; 251; 152)
LightGreen RGB(144; 238; 144)
MediumSpringGreen RGB( 0; 250; 154)
SpringGreen RGB( 0; 255; 127)
MediumSeaGreen RGB( 60; 179; 113)
SeaGreen RGB( 46; 139; 87)
ForestGreen RGB( 34; 139; 34)
Green RGB( 0; 128; 0)
DarkGreen RGB( 0; 100; 0)
YellowGreen RGB(154; 205; 50)
OliveDrab RGB(107; 142; 35)
Olive RGB(128; 128; 0)
DarkOliveGreen RGB( 85; 107; 47)
MediumAquamarine RGB(102; 205; 170)
DarkSeaGreen RGB(143; 188; 143)
LightSeaGreen RGB( 32; 178; 170)
DarkCyan RGB( 0; 139; 139)
Teal RGB( 0; 128; 128)

Blue colors

Aqua RGB( 0; 255; 255)
Cyan RGB( 0; 255; 255)
LightCyan RGB(224; 255; 255)
PaleTurquoise RGB(175; 238; 238)
Aquamarine RGB(127; 255; 212)
Turquoise RGB( 64; 224; 208)
MediumTurquoise RGB( 72; 209; 204)
DarkTurquoise RGB( 0; 206; 209)
CadetBlue RGB( 95; 158; 160)
SteelBlue RGB( 70; 130; 180)
LightSteelBlue RGB(176; 196; 222)
PowderBlue RGB(176; 224; 230)
LightBlue RGB(173; 216; 230)
PurwaBlue RGB(155; 225; 255)
SkyBlue RGB(135; 206; 235)
LightSkyBlue RGB(135; 206; 250)
DeepSkyBlue RGB( 0; 191; 255)
DodgerBlue RGB( 30; 144; 255)
CornflowerBlue RGB(100; 149; 237)
MediumSlateBlue RGB(123; 104; 238)
RoyalBlue RGB( 65; 105; 225)
Blue RGB( 0; 0; 255)
MediumBlue RGB( 0; 0; 205)
DarkBlue RGB( 0; 0; 139)
Navy RGB( 0; 0; 128)
MidnightBlue RGB( 25; 25; 112)

Brown colors

Cornsilk RGB(255; 248; 220)
BlanchedAlmond RGB(255; 235; 205)
Bisque RGB(255; 228; 196)
NavajoWhite RGB(255; 222; 173)
Wheat RGB(245; 222; 179)
BurlyWood RGB(222; 184; 135)
Tan RGB(210; 180; 140)
RosyBrown RGB(188; 143; 143)
SandyBrown RGB(244; 164; 96)
Goldenrod RGB(218; 165; 32)
DarkGoldenrod RGB(184; 134; 11)
Peru RGB(205; 133; 63)
Chocolate RGB(210; 105; 30)
SaddleBrown RGB(139; 69; 19)
Sienna RGB(160; 82; 45)
Brown RGB(165; 42; 42)
Maroon RGB(128; 0; 0)

White colors

White RGB(255; 255; 255)
Snow RGB(255; 250; 250)
Honeydew RGB(240; 255; 240)
MintCream RGB(245; 255; 250)
Azure RGB(240; 255; 255)
AliceBlue RGB(240; 248; 255)
GhostWhite RGB(248; 248; 255)
WhiteSmoke RGB(245; 245; 245)
Seashell RGB(255; 245; 238)
Beige RGB(245; 245; 220)
OldLace RGB(253; 245; 230)
FloralWhite RGB(255; 250; 240)
Ivory RGB(255; 255; 240)
AntiqueWhite RGB(250; 235; 215)
Linen RGB(250; 240; 230)
LavenderBlush RGB(255; 240; 245)
MistyRose RGB(255; 228; 225)

Grey colors

Gainsboro RGB(220; 220; 220)
LightGray or LightGrey RGB(211; 211; 211)
Silver RGB(192; 192; 192)
DarkGray or DarkGrey RGB(169; 169; 169)
Gray or Grey RGB(128; 128; 128)
DimGray or DimGrey RGB(105; 105; 105)
LightSlateGray or LightSlateGrey RGB(119; 136; 153)
SlateGray or SlateGrey RGB(112; 128; 144)
DarkSlateGray or DarkSlateGrey RGB( 47; 79; 79)
Black RGB( 0; 0; 0)

In addition, the string Background can be used to refer to the background colour that has been defined (e.g. by FRAME) for the particular part of the screen where the pen is being used, and the string Transparent can be used for example to define a colour that will not obscure anything that is plotted below it (e.g. in another window). Alternatively, you can define the colour intensity by three hexadecimal digits (0-F), by using a string starting containing first the character #, and then containing the three digits.

The roles of the negatively-numbered pens are listed below:

-1      initial default for PENTITLE parameter of XAXIS, YAXIS and ZAXIS

-2      initial default for PENAXIS parameter of XAXIS, YAXIS and ZAXIS

-3      initial default for PENLABEL parameter of XAXIS, YAXIS and ZAXIS

-4      initial default for PENGRID parameter of FRAME

-5      initial default for PENTITLE parameter of FRAME

-6      initial default for PENKEY parameter of FRAME

-7      default for PENGRID option of DSHADE

default for PENGRID option of DBITMAP

-8      default for PENOUTLINE option of DHISTOGRAM

-9      default for PENOUTLINE option of BARCHART

-10    default for PENOUTLINE option of DPIE

-11    default for XBARPEN and YBARPEN parameters of DGRAPH

default for PENERRORBARS parameter of BARCHART

-12    pen for title in DSTART


McConalogue, D.J. (1970). A quasi-intrinsic scheme for passing a smooth curve through a discrete set of points. Computer Journal, 13, 392-396.

See also


Procedures: DHELP, GETRGB.


Commands for: Graphics.


" Example DGRA-1: Draw a scatter plot"

" File DGRA-1.DAT contains data on deaths from lung cancer and smoking
  rates in 11 countries in 1930, from a US report in 1964."

" Read the data recorded in the file."
FILEREAD [NAME='%gendir%/examples/DGRA-1.DAT'] country,deaths,cigarettes

" Display the data in a high-resolution graph."
TEXT cancer; VALUES='Lung cancer and smoking in 1930'
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Add the axis titles and bounds, and a grid."
XAXIS WINDOW=3; TITLE='Cigarettes per man per year'; LOWER=0
YAXIS WINDOW=3; TITLE='Deaths per million'; LOWER=0
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Specify the axis labelling precisely."
XAXIS WINDOW=3; MARKS=!(0,300...1500)
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes

" Label the points with the names of the countries."
PEN 1; LABELS=country; SYMBOLS=0
DGRAPH [TITLE=cancer; WINDOW=3; KEYWINDOW=0] deaths; cigarettes; PEN=1

" Fit a linear regression line (assuming variance proportional
  to the square of the mean) to the relationship and
  add the fitted line to the graph."
MODEL [DISTRIBUTION=gamma; LINK=identity] deaths
FIT [PRINT=*] cigarettes
DGRAPH [SCREEN=keep; WINDOW=3; KEYWINDOW=0] fit; cigarettes; PEN=2
Updated on January 16, 2018

Was this article helpful?