1. Home
  2. DMSCATTER procedure

DMSCATTER procedure

Produces a scatter-plot matrix for one or two sets of variables (J. Ollerton & R.W. Payne).

Options

PLOT = string tokens Additional information to include in the scatter plots (correlation, histograms, boxplots, densities, dothistograms); default *
SCALING = string token How to scale the x- and y-axes (common, equal, none); default none
PEN = scalar or variate or factor Pens to plot the scatter plots; default 1
PENHISTOGRAM = scalar Pens to plot the histograms; if PEN is a factor the default plots the histogram for each group separately using the pen used for that group in the scatter plots, otherwise the default is to use pen 2
PENCORRELATION = scalar Pen to use to write the correlations; default 1
PENTITLE = scalar Pen to use to write the axis titles; default uses the pens currently defined for the axes in the windows that are used for the plots
PENAXIS = scalar Pen to use to draw the axes; default uses the currently defined pens
PENLABELS = scalar Pen to use to write the axis labels; default uses the currently defined pens
NROWS = scalar Number of rows of graphs to put in a single frame (i.e. page); default puts them all in one frame
NCOLUMNS = scalar Number of columns of graphs to put in a single frame; default uses the same value as NROWS
ASPECTRATIO = scalar Ratio of the length of the y-axis to the length of the x-axis in each graph
FRAMESHAPE = string token Shape of the plotting frame (landscape, portrait, square); default squa
MARGINSIZE = scalar Specifies the size of the margins at the bottom and left-hand edge of the frame

Parameters

Y = pointers Each pointer contains a set of variates and/or factors to be plotted
X = pointers Each pointer contains a set of variates and/or factors to be plotted as the x-variables in a rectangular scatter-plot matrix; if unset Y specifies both the x-variables and y-variables for a symmetric scatter-plot matrix
TITLE = texts Overall title for the plot
YTITLES = texts Labels for the axes for the Y variates and factors, to use instead of their identifiers
XTITLES = texts Labels for the axes for the X variates and factors, to use instead of their identifiers
YMARKS = variates, scalars or pointers Marks to use on the axes for the Y variates and factors, if any of these contains missing values, the marks and their labels are suppressed for that variate or factor
XMARKS = variates, scalars or pointers Marks to use on the axes for the X variates and factors, if any of these contains missing values, the marks and their labels are suppressed for that variate or factor

Description

Procedure DMSCATTER produces two types of scatter-plot matrix, using high-resolution graphics. For a symmetric scatter-plot matrix, the variates and/or factors to be plotted against each other must be specified, in a pointer, by the Y parameter. The scatter-plot contains a lower-triangular array of graphs, one for each pair of variables. Alternatively, for a rectangular scatter-plot matrix, there are two set of the variates and/or factors. The set that defines the y-values for the graphs are specified (in a pointer as before) by the Y parameter, and those that define the x-values for the graphs are specified (also in a pointer) by the X parameter. The scatter-plot now contains a rectangular array of graphs, one for each pair of x- and y-variables.

By default the identifiers of the relevant x- and y-variables are used for the titles of the axes at the lower and left-hand edges of the graphics frame (i.e. page). Alternatively, you define your own titles for the y-variables by setting the YTITLES to a text with a value for each Y variate or factor. Similarly, you can use the XTITLES parameter to supply your own titles for the X variates or factors. You can also use the TITLE parameter to supply an overall title.

The YMARKS parameter allows you to specify your own marks for the axes corresponding to the y-variables. (These are then used as the settings of the MARKS parameter of the YAXIS and XAXIS directives.) You can set YMARKS to single variate or scalar, if you want to use the same marks for every y-variable. Alternatively, you can set it to a pointer with a variate or factor for each Y variate or factor, if you want to specify different marks. If any of the variates or scalars contains missing values, the marks and their labels are suppressed on the corresponding axes. You can use the XMARKS parameter similarly, to specify axis marks for the x-variables.

The PEN option specifies the pens to be used to plot the graphs. The setting can be a scalar to plot all the points with the same pen, or a variate or a factor to use different pens. If PEN is set to a factor, a key is included in the plot to identify the correspondence between the pens and the groups. The default is to use pen 1.

The PLOT option allows you to specify extra information to be included in the plot, with settings:

    correlation prints the correlation of the pair of variables in each plot, at the top of the plot;
    histograms plots histograms of the variables down the diagonal of a symmetric scatter-plot matrix, or along the top and down the right-hand side of a rectangular scatter-plot matrix;
    boxplots displays boxplots of the variables down the diagonal of a symmetric scatter-plot matrix, or along the top and down the right-hand side of a rectangular scatter-plot matrix;
    densities displays one-dimensional density plots (or violin plots) of the variables down the diagonal of a symmetric scatter-plot matrix, or along the top and down the right-hand side of a rectangular scatter-plot matrix; and
    dothistograms plots dot histograms of the variables down the diagonal of a symmetric scatter-plot matrix, or along the top and down the right-hand side of a rectangular scatter-plot matrix.

Note, only one of the settings histograms, boxplots, densities, dothistograms is allowed; if more than one is set, the first item the list above is used.

The PENHISTOGRAM option specifies the pens to plot the histograms. If PEN is a set to a factor, the default for PENHISTOGRAM plots histogram for each group, using the pen used for that group in the scatter plots. Otherwise the default is to use pen 2. The PENCORRELATION option specifies the pen to use to print the correlations; default 1.

The PENTITLE, PENAXIS and PENLABELS options define the pens to use for the titles of the x- and y-axes, for the axes themselves, and for their labels. If any of these is unset, the default is to use the pens already defined for that aspect of the axes in the windows used in the plot.

The SCALING option controls the scaling of the x- and y-axes, the settings:

    equal uses equal scaling for the x- and y-axes in each graph,
    common used exactly the same axes (upper and lower limits as well as scaling) for the axes in all the graphs,
    none defines all the axes independently (the default).

By default the plots are square, but you can request rectangular plots by setting the ASPECTRATIO option to the required value for the length of the y-axis divided by the length of the x-axis.

The MARGINSIZE option specifies the size of the margins at the bottom and left-hand edge of the graphics frame. If this is unset, the margins are defined automatically, using a smaller value if all the axis marks and labels on an edge have been suppressed.

The FRAMESHAPE option specifies the shape of the graphics frame, with settings:

    landscape for a frame of size 1.4 × 1.0 i.e. wider in the x- than the y-direction,
    portrait for a frame of size 1.0 × 1.4 i.e. wider in the y- than the x-direction,
    square for a frame of size 1.0 × 1.0.

Some graphics devices do not support the use of device cordinates greater than 1.0, so the default is FRAMESHAPE=square. (See FRAME and DEVICE for more information.)

By default the graphs are all plotted in a single frame (i.e. page), but you can specify the NROWS and NCOLUMNS options to split them across several frames. NROWS specifies the number of rows of plots to put in a single frame. The default is to fit them all into one frame. NCOLUMNS specifies the number of columns of plots to put in one frame. The default is to use the same value as NROWS.

Options: PLOT, SCALING, PEN, PENHISTOGRAM, PENCORRELATION, PENTITLE, PENAXIS, PENLABELS, NROWS, NCOLUMNS, ASPECTRATIO, FRAMESHAPE, MARGINSIZE.
Parameters: Y, X, TITLE, YTITLES, XTITLES, YMARKS, XMARKS.

Action with RESTRICT

If any of the variates or factors is restricted, only the units not excluded by the restriction will be plotted.

See also

Directive: DGRAPH.
Procedures: DSCATTER, TRELLIS, BOXPLOT, DXDENSITY, DOTHISTOGRAM, D2GROUPS
Commands for: Graphics.

Example

CAPTION   'DMSCATTER example'; STYLE=meta
SPLOAD    [PRINT=*] '%GENDIR%/Data/Iris.gsh' 
POINTER   [VALUES=Petal_Length,Petal_Width,Sepal_Length,Sepal_Width]\
          Measurements
DMSCATTER [PLOT=correlation,histograms; PEN=Species] Measurements
Updated on February 7, 2023

Was this article helpful?