Spotfire® User Guide

Assigning colors to categorical or continuous data

When you configure coloring for a visualization, the first step is to choose which column to color by, and then you can choose how the colors should be assigned to the values in that column. For example, you can determine whether you want the items in your visualization to get distinct colors representing different categories, or if you want to see a gradient color transition between two or more anchor points in a range of values.

About this task

Which options are available depends on the characteristics of the column or hierarchy you choose to color the visualization by. When a column in categorical axis mode is used, coloring is always applied as Categories. When a column in continuous axis mode is used, the following options are available: Gradient, Segments, and Unique values. The data type in the selected column decides which axis mode the column will be set to by default, as well as if it is possible to change the axis mode.
Note: Coloring in tables, cross tables, and heat maps, works slightly differently than most other visualization types and can only be configured in the installed client. See Coloring in tables, cross tables, and heat maps to learn about coloring for those visualizations.

The examples below show the Color by section of the visualization properties panel. In the Colors/Color section of the visualization properties dialog in the installed client/web client respectively, the available options are slightly different.

Categories

When the selected column is in categorical axis mode, for example containing string values, the colors are always applied as categories, where each value in the column gets a separate color, as seen in the image below.

Unique values

For columns in continuous axis mode, you can select the option Unique values, which is similar to the categorical coloring that is available for columns in categorical axis mode. Each unique value in the column gets a separate color, as seen in the example below.

Note: While Unique values might appear as if the coloring is categorical, it is not categorical in the true sense. Because the column used to color by is in continuous axis mode, the coloring is also considered continuous. This means that if you are using multiple scales in the visualization, you should not use individual scaling per color, because you might end up with a different result than the expected. For lines and curves, this means that you cannot set them to one line or curve per color.

Gradient

For columns in continuous axis mode, Gradient coloring is also available. The items in the visualization will show a color gradient between two or more anchor points, as seen in the example below.

The scatter plot above is colored by the column Sales, and the color range has three anchor points: Min, Average, and Max. You can see the anchor points both in the legend and in the visualization properties to the right.

Segments

Another option for columns in continuous axis mode is Segments. This will color the items representing values between two or more anchor points in fixed colors, as seen in the example below.

The scatter plot above is colored by the column Sales, and in this case the color range has four anchor points: Min, Average, 30, and Max. The colors between these points are set to blue, red, and yellow respectively. This means that items representing values between the Min value (8) and the average value (18) are colored blue, items representing values between average and 30 are colored red, and items representing values greater than 30 are colored yellow. An anchor point will get its color from the segment above it on the scale. In the example above, this means that an item representing the value 30 will be yellow.

Note: While Segments might appear as if the coloring is categorical, it is not categorical in the true sense. Because the column used to color by is in continuous axis mode, the coloring is also considered continuous. This means that if you are using multiple scales in the visualization, you should not use individual scaling per color, because you might end up with a different result than the expected. For lines and curves, this means that you cannot set them to one line or curve per color.

Anchor points

When you have colored the visualization using Gradient or Segments, you can add anchor points to the color range, where you want the gradient or segment to switch to another color, by clicking Add point. To specify the exact placement of the added anchor point, you can write an expression or enter an absolute value, or select one of the suggested expressions from the menu to the right on the anchor point, or , depending on where you open the visualization properties. For details on the menu options, see Available options in the Value/Point menu.
Note: If you select an expression, an anchor point that is relative to the current scale will be added. For example, if you select Average, the position of the anchor point will be adjusted automatically when you filter the data, so that it stays at average for the new range of values. If you instead enter an absolute value for the anchor point, keep in mind that it can end up outside the range of values if you filter out data, or select another column to color by.