Heat maps



Bar HeatMap.png
Bar HeatMap2.png

Requirements

The requirements for a heat map are

  • The indexes for both axes must be categorical.
  • The value depicted by color must be categorical.

The indexes and the value must each contains no more than 30 distinct values. In the above graphs, the value contains only five distinct values.

Preparing your result variable

Correlation is a continuous quantity, but to create the heat map, correlations are mapped into five discrete categories. First, you create an index named Color_range with the five labels:

Heat map color range.png

Then you create a table, Bound, with the lower bound of each range:

Heat map bound.png

You then use this to discretize the continuous correlations using StepInterp.

StepInterp(Bound, Color_range, Abs(Correlation_matrix), Color_range, leftLookup: True)

The result is a 2-D array of labels:

Heat map table.png

When you create a heat map, you are actually graphing textual (or at least categorical) labels.

Configuring the graph

Once you have a result that satisfies the requirements, you create the heat map graph:

  1. Show the result graph
  2. Double-click on the graph to go to graph setup.
  3. Select Bar style. Set Overlap to 100%. Click Apply.
  4. Set Key to be your main value. Set the Horizontal Axis and Vertical Axis to the two indexes. Cluster should be empty.
  5. Bring up graph setup again and click the Axis Ranges tab. Check Categorical for both axes. Press Apply.

Configuring colors

To customize the colors, right-click on any color block and select Change Color Series.... From that dialog, select the desired colors. In most cases, you will want to leave the default as "General color sequence, this graph only.".

Encapsulating as a graph style template

If you want to create more than one heat map, you can save the graph setup and color customizations in a graph style template to streamline the process of configuring future heat maps. You have two options here: (1) Save all the graph settings, or (2) save just the customized color scheme.

Saving all graph settings

To create a graph style template with all the graph setup changes, show your result graph, then:

  1. Double-click on the background to bring up graph setup
  2. In the Style template: field at the bottom, select New Template.
  3. Type a name for the template, e.g., Heat map blue
  4. . Press Set Template

With this graph style template now created, you can create a second heat map with fewer steps:

  1. Create indexes and a variable meeting the requirements at the beginning of this page.
  2. Show the result graph, go to graph setup and select "Heat map blue" for the Style template. Press Apply.
  3. Set Key to be your main value. Set the Horizontal Axis and Vertical Axis to the two indexes. Cluster should be empty.
  4. Bring up graph setup again and click the Axis Ranges tab. Check Categorical for both axes. Press Apply.

The last step will not be necessary if you are using the same indexes used in the first heat map, or if the indexes are already categorical.

Saving only the color series

We actually prefer saving just the custom color series into the graph style template, without all the other graph settings mixed in. This allows us to select the custom color series in any context without altering graph settings that might not apply if we are using the colors for something else.

To do this, you need to first create an empty graph style template. To do that,

  1. create a new variable, Va1, define it as Time
  2. show its graph and double-click to Graph Setup.
  3. Select New Template in the Style Template control at the bottom and type a name, say Blue heat colors
  4. Press Set Template
  5. Delete Va1 -- you're done with it.
    • At this point, blue heat colors has been created as a new graph style template, but is empty, since Va1 had no graph settings configured.
  6. Show your heat map graph and double-click to its Graph Setup.
  7. Set Style Template to Blue heat colors and press Apply
  8. Right-click on a colored block on the graph and select Change Series Colors...
  9. Select the apply to the graph style template radio button option. Press OK.

To apply these colors to another graph, you'll set the Style template in graph setup to Blue heat colors and press Apply.

Download an example

Download a Heat map.ana example model.

History

Introduced in Analytica 4.6.

See Also

Comments


You are not allowed to post comments.