In the previous posts (, ), we covered several aspects on using the Color Map Editor panel in ParaView introduced in version 4.1. In this final installment in the series, we take a look at categorical colors and how they can be useful for certain visualization use-cases.
A picture is worth a thousand words, they say, so let’s just let the picture do the talking. Categorical color maps allow you to render visualizations as shown in Figure 1.
Figure 1: Visualization using a categorical color map for discrete coloring
Categorical color maps, introduced in 4.0.1, provide an elegant solution for such cases. Instead of a continuous color transfer function, user specifies a set of discrete values and colors to use for those values. For any element where the data value exactly matches the values in the lookup table, ParaView renders the specified color, otherwise the NaN color is used.
The color legend or scalar bar also switches to a new mode where it renders swatches with annotations, rather than a single bar. Users can add custom annotations for each value in the lookup table.
The User Interface
To tell ParaView that the data array is to be treated as categories for coloring check the Interpret Values As Categories checkbox in the Color Map Editor panel. As soon that’s checked, the panel switches to categorical mode: the Mapping Data group is hidden and Annotations group becomes a non-advanced group i.e. the annotations widget is visible even if the panel is not showing advanced properties, as shown in Figure 2.
Figure 2: Default Color Map Editor when Interpret Values As Categories is checked
Figure 3: Choose preset dialog for categorical color maps
Also Add active values plays the same role as described in previous post: fill the annotations widget with unique discrete values from the data array, is possible. Based on the number of distinct values present in the data array, this may not yield any result (instead a warning message will be shown).
To see how to use categorical colors for coloring contours, check out my previous blog post.
Categorical color maps are designed for data arrays with enumerations which are typically integer arrays. However they can be used for arrays with floating point number as well. However with floating point numbers, the value specified for annotation may not exactly match the value in the dataset even when the user expected it to match. In that case, the NaN color will be used. In future, we may add a mechanism to specify a delta to use to when comparing data values to annotated values.