Color gradients

Syntax: | `DENSITY { x y } z { p1 p2 }`
Qualifiers: | `\LEGEND, \HISTOGRAM, \PARTIAL, \XPROFILE, \YPROFILE, \BORDER, \AXES, \RESET`
Defaults: | `if `z` is a matrix: `x=[1;2;3;...], y=[1;2;3;...],` `p1 = 0, p2 = 1,` \LINEAR, \-PARTIAL, \-XPROFILE, \-YPROFILE, \BORDER, \AXES, \RESET`

Color gradients is the default density type. No qualifiers are needed to produce this type of drawing. The range of values of the matrix is divided into ten (10) equal levels, and a different color is associated with each level. By default, a value is interpolated at each pixel location within the matrix region so as to give smoothly joined regions.

Input variables

If `z` is a vector, the parameters `x` and `y` are expected and must be vectors. `x` and `y` are assumed to represent a scattered set of points, where `z[i]` is the altitude corresponding to the location `(x[i],y[i])`. A matrix is interpolated on these scattered points by means of a Thiessen triangulation of the plane. The three vectors must be the same length.

If `z` is a matrix, the parameters `x` and `y` default to `[1;2;3;...]`, but if entered they must be vectors. Each matrix element, `z[i,j]`, is associated with the coordinates `(x[j],y[i])`. The length of `x` must be equal to the number of columns of `z` and the length of `y` must be equal to the number of rows. The vectors `x` and `y` are used for scaling the axes.

Not interpolated gradients

If the `\HISTOGRAM` qualifier is used, each data location is represented by a rectangle of color, centered on the data location. The regions are not smoothly joined.

Changing the range of values

The optional parameters `p1` and `p2` can be used to broaden or shrink the range of data values. If `zmax` is the maximum value of the data and `zmin` is the minimum value of the data, the full color range will be from a minimum of `p1*(zmax-zmin)+zmin` to a maximum of `p2*(zmax-zmin)+zmin`. If `z` is a data value and if `z < p1*(zmax-zmin)+zmin`, that data value is treated as `zmin`. If `z > p1*(zmax-zmin)+zmin`, that data value is treated as `zmax`. The default values are: `p1=0` and `p2=1`.

Legend

If the `\LEGEND` qualifier is used, a legend is drawn along the right side of the axes. The legend requires the right end of the x-axis to be set to `75%` of the window, that is, `XUPPERAXIS` is set to `75%`.

When a y-profile is drawn, using the `\YPROFILE` qualifier, the right edge of the axis box must allow space for the profile as well as a possible legend. If a y-legend profile and a legend are present, then `XUPPERAXIS` is set to `65%`. If a y-legend profile is present but not a legend, then `XUPPERAXIS` is set to `85%`.

By default, `XUPPERAXIS` is reset to its former value after the `DENSITY` command. If the `/-RESET` qualifier is used, the axis location is not reset.

Examples

These examples use the following vectors.

     X=[  1;  0;  1;  0;   .2; .3;   .5;  .8]
     Y=[  5;  5;  0;  0;    1;1.5;  2.5;   4]
     Z=[ 10; 10; 10; 10; -100; 10; -100; 500]

`SET COLORMAP THERMAL`
`DENSITY\LEGEND X Y Z`

`SET COLORMAP RAINBOW`
`DENSITY\LEGEND X Y Z`

DENSITY command
DITHERING