Industrial Data Science
in C# and .NET:
Simple. Fast. Reliable.
 
 

ILNumerics - Technical Computing

Modern High Performance Tools for Technical

Computing and Visualization in Industry and Science

tgt

Surface Coloring

Three modes exist for coloring surfaces: Solid, RGBA and Colormapped. The mode determines how colors are computed for each grid point of the surface and is set by the Surface.ColorMode property. Another convenient way is to use one of the UpdateSolidColor(), UpdateRGBA() or UpdateColormapped() functions, which do not only set the corresponding color mode but also allow the (re-)configuration of all related parameters and settings after creation.

 

Solid Coloring

In the simplest coloring mode a single color is used for the fill colors of the whole surface. The color is determined by the solidColor parameter in the

function. The surface is switched into single color mode and solidColor is used as fill color.

Note, transparency (i.e.: arbitrary alpha values) is still allowed for solidColor. Solid color mode is best be used in conjunction with lit surfaces (See: Surface Lighting).

 

RGBA Coloring

In RGBA mode each grid point of the surface gets an individual color assigned. The UpdateRGBA() function receives an array with RGB or RGBA tuples of the same size as the grid mesh. In the following example, the UpdateRGBA() function is utilized to configure the color and transparency for each grid point.

 

Colormapped Coloring

In colormapped rendering the color for a surface grid point is derived from a colormap associated with the surface. A colormap translates numeric data values from a certain range to a color.

The numeric data values of the grid data points can be specified programmatically or derived from the Z coordinates of the grid data points. If no data values are given, the Z coordinate of the surface grid points are used.

 

Colormap by ILNumerrics

The translation from a data value at a certain grid point to the final color is shown in the image. The predefined colormap “Hot” was configured for the surface here. It spans colors from black over red and yellow to white. That span is associated to a certain data range: here, black is the lower end of the colormap and corresponds to a value of -1. The upper limit of the colormap (white) corresponds to a data value of 1.7. Data ranges are automatically derived from the data values (if specified) or manually configured. The axis scale in every colorbar shows the full data range for the current colormap as axis numbers next to the colormap area.

In order to get the full flexibility for configuring colors in color mapped mode, one needs to keep the following properties in mind: Data Values, Data Range and Colormap. The Update function overload

allows the definition of all color mapped related properties at the same time. All parameters are optional. If omitted, useful default values will be chosen. Calling this function will leave the surface in color mapped mode.

Note that the colormap parameter does expect an Colormap class instance. It can be created by providing arbitrary color value matrices of custom colormaps or one of the predefined Colormaps enumeration values (which creates a new Colormap instance implicitly).

Note further, the color mapped mode is the only color mode for surfaces, where colorbars will be displayed. Even if it was added to the surface – in all other modes the colorbar will be invisible.