A scalar field is a representation of a 2-D array of numbers, using colors to represent the numerical values, sometimes referred to as a heat map. The values can be represented using a single, discrete color over a grid or as a continuous, smoothed surface (i.e, 2D interpolation).
To represent this array of numbers, the data could be in a wide format, values in the array are stored in separate columns, or a long format, values are stored in a single list.
The long or flattened format is required by the Scalar field command. For instructions on how to quickly reformat data from the wide to long format see: How to ‘Flatten’ Data.
Basic Scalar Field
The Scalar Field command allows you to apply colors, contours, or labels using data that is mapped to an x-y grid.
Given a data set with three columns, x, y, and z. The values for x and y vary from 1 to 3. The values for z increase from 1 to 9.
- Select Command > Add Scalar Field.
- Specify the Values and the spatial location (x, y).
This creates a simple scalar field, where the color of each square is based on the value of z. Turn on the hover (Shift-⌘-H) to view the corresponding value for each square.
By default, the colors are set to a continuous is a color ramp, from black to white.
Here, the ‘x’ and ‘Amount’ columns are the same, but y is replaced with a text column called ‘Group’.
The axis style now show as categorical (tick marks between categories) and the ‘A’ data is in the first y location.
Here the value at (2, 3) is missing in the data table. This was set to 8 above.
By default, any missing values will be encoded to black.
NOTE: When you use a custom color ramp, you can define the color for a missing value.
The Scalar Field requires the Values (‘z’ dimension) to be in a single number column.
NOTE: If your values are in multiple columns, use Flatten Columns under the Data menu. This appends the data into one long column and creates a new column with an entry corresponding to the column header.
The Layout menu has several options for specifying the (x, y) locations.
- Flattened (default)
- Row or Column First
- Uniform row or column
Flattened vs. Row (or Column) First
Both of these options require x and y input columns. The ‘Flattened’ format requires every value to have a corresponding x and y location. The ‘Row or Col First’ format only requires that the unique values for x and y are given,
When you select Row or Col First, the program builds the grid according the values and length of the ‘x’ and ‘y’ columns. ‘Row first’ orders the values by across to build the grid (x-direction).
‘Col first’ orders the values up to build the grid (y-direction).
Uniform Row or Column
When the Layout is set to ‘Uniform Row’ or ‘Column’, the x-y grid locations are specified using the following input:
- Origin — The bottom left corner of the grid (x, y).
- Step — The distance between each grid point.
- Size — The dimensions of the grid (m, n).
With this information, the scalar field can be drawn.