NAG Library Routine Document
g01agf (withdraw_plot_scatter_2var)
1
Purpose
g01agf performs a scatter plot of two variables on a character printing device, with a chosen number of character positions in each direction.
2
Specification
Fortran Interface
Integer, Intent (In)  ::  nobs, nstepx, nstepy  Integer, Intent (Inout)  ::  ifail  Integer, Intent (Out)  ::  isort(nobs)  Real (Kind=nag_wp), Intent (In)  ::  x(nobs)  Real (Kind=nag_wp), Intent (Inout)  ::  y(nobs) 

C Header Interface
#include nagmk26.h
void 
g01agf_ (const double x[], double y[], const Integer *nobs, Integer isort[], const Integer *nstepx, const Integer *nstepy, Integer *ifail) 

3
Description
g01agf finds the range of the data in each dimension and calculates a step size for each division on the axes; these step sizes are selected from the list
The axes are drawn and annotated and data points are plotted on the nearest character position. The character plotted is either a digit $1$ to $9$ for the equivalent number of occurrences of a point at a particular character position, an alphabetic A–Z for $10\u201335$ occurrences, or * if there are more than $35$ coincident occurrences. Axes are drawn on all sides of the plot with the lefthand and bottom ones annotated; zero axes are also marked if included in the plotting area.
The Fortran logical unit number used for the output is the current advisory message unit number defined for each implementation. This number may be changed by an appropriate call to
x04abf before calling
g01agf.
4
References
None.
5
Arguments
 1: $\mathbf{x}\left({\mathbf{nobs}}\right)$ – Real (Kind=nag_wp) arrayInput

On entry: the values to be plotted in the $x$direction.
 2: $\mathbf{y}\left({\mathbf{nobs}}\right)$ – Real (Kind=nag_wp) arrayInput/Output

On entry: the values to be plotted in the $y$direction.
On exit: the elements of
y are sorted into descending order of magnitude.
 3: $\mathbf{nobs}$ – IntegerInput

On entry: the number of observations to be plotted.
Constraint:
${\mathbf{nobs}}\ge 1$.
 4: $\mathbf{isort}\left({\mathbf{nobs}}\right)$ – Integer arrayOutput

On exit: the key to the descending order of the elements in array
y, i.e.,
${\mathbf{isort}}\left(\mathit{i}\right)$ contains the position of the value
${\mathbf{y}}\left(\mathit{i}\right)$ in the original array
y, for
$\mathit{i}=1,2,\dots ,{\mathbf{nobs}}$.
 5: $\mathbf{nstepx}$ – IntegerInput

On entry: the number of steps (character positions) to be plotted in the
$x$direction. If the supplied value of
nstepx is less than
$10$, the value
$10$ will be used by
g01agf. The maximum value for
nstepx is the number of character positions available on the chosen output device less
$15$, up to a maximum of
$133$. If
nstepx exceeds
$133$ on input, the value
$133$ will be used by the routine.
 6: $\mathbf{nstepy}$ – IntegerInput

On entry: the number of steps (character positions) to be plotted in the
$y$direction. If the supplied value of
nstepy is less than
$10$, the value
$10$ will be used by
g01agf. There is no maximum value for
nstepy, but you should bear in mind that
$\left({\mathbf{nstepy}}+5\right)$ records (lines) of output are generated by the routine.
 7: $\mathbf{ifail}$ – IntegerInput/Output

On entry:
ifail must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
$0$.
When the value $\mathbf{1}\text{ or}\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit:
${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
${\mathbf{ifail}}=0$ or
$1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
 ${\mathbf{ifail}}=1$

On entry, ${\mathbf{nobs}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{nobs}}\ge 1$.
 ${\mathbf{ifail}}=99$
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
 ${\mathbf{ifail}}=399$
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
 ${\mathbf{ifail}}=999$
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
Accuracy is limited by the number of plotting points available.
8
Parallelism and Performance
g01agf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
The time taken by g01agf may be expected to be approximately proportional to the product ${\mathbf{nobs}}\times {\mathbf{nstepx}}\times {\mathbf{nstepy}}$.
No blank records are output before or after the plot.
You must make sure that it is permissible to write records containing
nstepx characters to the current advisory message unit.
10
Example
The data relate to wheat and potato yields in
$48$ counties in England in 1936. The example illustrates the use of
x04abf to set the logical unit number, used for the output of
g01agf, to a specified value.
10.1
Program Text
Program Text (g01agfe.f90)
10.2
Program Data
Program Data (g01agfe.d)
10.3
Program Results
Program Results (g01agfe.r)