1. Home
  2. DHEATMAP procedure

DHEATMAP procedure

Plots a heatmap (R.W. Payne).

Options

START = scalars or text Initial colour; must be set
END = scalars or text Final colour; must be set

Parameters

VARIATE = variates  Variate to define the heat for each map
Y = variate Vertical coordinates
X = variate Horizontal coordinates
MINIMUM = scalars Value corresponding to the START colour for each VARIATE; default uses its minimum value
MAXIMUM = scalars Value corresponding to the END colour for each VARIATE; default uses its maximum value
PENGRID = scalars Pen to draw the grid for each map; default uses an internally defined pen
LABELS = variates, factors or texts  Labels to superimpose on each map; default * i.e. none
PENLABELS = scalars Pens for the labels; default uses an internally defined pen
TITLE = texts Title for each graph
WINDOW = scalars Window for each graph; default uses an internally defined version of window 1
KEYWINDOW = scalars Window for the key for each graph; default uses an internally defined version of window 2
SCREEN = string token Whether to clear the screen before plotting each graph (clear, keep); default clear
KEYDESCRIPTION = text Title for the key; default ‘Heat colours’
LDIRECTION = string token Direction in which to plot the labels (horizontal, vertical, automatic); default hori

Description

DHEATMAP plots a heatmap to provide a visual display of the values of a variate over two dimensions. The variate is specified by the VARIATE parameter, and the coordinates for the plot are specified by the Y and X parameters. The START option defines the initial heat colour, in a scalar containing an RGB value, or in a text containing the name of one of the standard colours. (See the PEN directive for details.) The corresponding initial value for the VARIATE is specified by the MINIMUM parameter. If this is not set, the default is to use the minimum value of the VARIATE. Similarly, theEND option defines the final heat colour, and the corresponding final value for the VARIATE is specified by the MAXIMUM parameter (with a default of the maximum value of the VARIATE).

The LABELS parameter can supply a variate, factor or text to define labels to be superimposed on the plot. The LDIRECTION option controls whether the labels are plotted horizontally (default), or vertically, or with the direction determined automatically. With the automatic setting, the labels are plotted horizontally unless boxes of the heatmap are taller than wide. By default the labels are plotted in black with size one. However, you can use the PENLABELS parameter to specify a pen with some other definition. Similarly, the grid is plotted in black with a solid line style, but you can use the PENGRID parameter to specify a pen with some other definition.

The WINDOW and KEYWINDOW parameters can specify a window for the graph and for a key. If WINDOW is not specified, DHEATMAP redefines window 1 to be suitable for the heatmap. It also redefines window 2 for a key unless KEYWINDOW is set to zero. The window for the heatmap then takes up the whole of the screen. Otherwise, if the range of y-coordinates is greater than the range of x-coordinates, the key is to the right of the heatmap, and their windows use the full space vertically. If the range of y-coordinates is not greater than the range of x-coordinates, the key is below the heatmap, and their windows use the full space horizontally. The original graphics environment is restored afterwards, so that these windows regain their original sizes and locations.

The TITLE parameter can provide a title for the heatmap. The default is “Heatmap for VARIATE-name”. The SCREEN parameter indicates whether any existing plots on the screen are to be kept or cleared (default), and the KEYDESCRIPTION parameter can supply a title for the key (default ‘Heat colours’).

 

Options: START, END

Parameters: VARIATE, Y, X, MINIMUM MAXIMUM, PENGRID, LABELS, PENLABELS, TITLE, WINDOW, KEYWINDOW, SCREEN KEYDESCRIPTION, LDIRECTION

Method

DHEATMAP uses the FHEATCOLOURS procedure to a variate containing the heat colours. It then plots these, with the labels, using the DDESIGN procedure. The key is plotted by the DBANDCOLOURS procedure.

See also

Directives: DBITMAP, DCONTOUR, DSHADE, DSURFACE, PEN

Procedures: DBANDCOLOURS DDESIGN FHEATCOLOURS 

GenStat Reference Manual 1 Summary section on: Graphics

Example

CAPTION  'DHEATMAP example'; STYLE=meta
" Split plot design fom Yates (1935), The Design and Analysis of
  Factorial Experiments, Commonwealth Bureau of Soils, T.C. 35 p.74) "

SPLOAD        '%data%/Oats.gsh'

FACPRODUCT     !p(blocks,wplots); PRODUCT=blocks_and_wholeplots
" field plan with heat map for yield, labelled by variety "

DHEATMAP       [START='blue'; END='yellow'] yield; Y=blocks_and_wholeplots; X=subplots;\
            MINIMUM=0; MAXIMUM=200; LABELS=variety; TITLE='Oats'

Updated on April 15, 2024

Was this article helpful?