1. Home
2. DXYGRAPH procedure

# DXYGRAPH procedure

Draws two-dimensional graphs with marginal distribution plots alongside the y- and x-axes (D.A. Murray).

### Options

`YMETHOD` = string token Distribution plot to display in the margin of the y-axis (`histogram`, `rugplot`, `boxplot`); default `hist` Distribution plot to display in the margin of the x-axis (`histogram`, `rugplot`, `boxplot`); default `hist` Defines the number of groups in a margin plot of a histogram of the `Y` variate; default is then 10, or the integer value nearest the square root of the number of values in the `Y` variate if that is smaller Defines the number of groups in a margin plot of a histogram of the `X` variate; default is then 10, or the integer value nearest the square root of the number of values in the `X` variate if that is smaller Colour to use for the `Y` margin plot Colour to use for the `X` margin plot

### Parameters

`Y` = variates or factors Vertical coordinates Horizontal coordinates General title for the plot; default `*` Window number for the graphs; default 1 Window number for the key (zero for no key); default 2 Pen number for each graph; default * uses pens 1, 2, and so on for the successive graphs Whether to clear the screen before plotting or to continue plotting on the old screen (`clear`, `keep`); default `clea`

### Description

The `DXYGRAPH` procedure draws high-resolution two-way plots with a distribution plot alongside the y- and the x-axis. The main part of the graph is an ordinary two-dimensional graph (e.g. a point or line plot), which is plotted by the `DGRAPH` directive in the usual way. The `Y` and `X` parameters supply the y- and x-coordinates of the items to be plotted, exactly as in `DGRAPH`, and the `PEN` parameter can specify graphics pens to define how the plotting is done. See `DGRAPH` for full details.

The `YMETHOD` option specifies the type of distribution plot to be displayed alongside the y-axis. By default this is a histogram. Alternatively, you can set `YMETHOD=rugplot` to produce a rug plot, or `YMETHOD=boxplot` to display a schematic boxplot. Similarly, the `XMETHOD` option controls the distribution plot displayed below the x-axis. By default the number of groups used to draw a marginal plot of a histogram is either 10, or the integer value nearest the square root of the number of values in the associated variate if that is smaller. Alternatively, you can specify the number of groups using the `YNGROUPS` and `XNGROUPS` for the `Y` and `X` marginal plots respectively. The `YCOLOUR` and `XCOLOUR` options can be used to specify the colours to be used for the margin plots.

The `WINDOW` parameter defines the window in which the graph is drawn (default 1), and the `KEYWINDOW` parameter specifies the window in which the key appears (default 2). You can set `KEYWINDOW=0` to suppress the key. The `TITLE` parameter can be used to provide a title for the graph, and the `SCREEN` parameter controls whether the graphical display is cleared before the graph is plotted.

Options: `YMETHOD`, `XMETHOD`, `YNGROUPS`, `XNGROUPS`, `YCOLOUR`, `XCOLOUR`.

Parameters: `Y`, `X`, `TITLE`, `WINDOW`, `KEYWINDOW`, `PEN`, `SCREEN`.

### Action with `RESTRICT`

You can arrange to plot only a subset of the points specified by a particular pair of `Y` and `X` vectors and associated `PEN` vector, by restricting any one of them. If more than one of these is restricted, then they must all be restricted in exactly the same way.

Directive: `DGRAPH`, `DHISTOGRAM`.

Procedures: `BOXPLOT`, `RUGPLOT`.

Commands for: Graphics.

### Example

```CAPTION  'DXYGRAPH example','Sulphur polution data'; STYLE=meta,plain