Difference between revisions of "Heat maps"
(Created page with "''Requires Analytica 4.6'' image:Bar_HeatMap.png image:Bar_HeatMap2.png The requirements for a heat map are * The indexes for both axes must be categorical. * Th...") |
|||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category: Graphs]] | |
− | + | __TOC__ | |
− | |||
+ | |||
+ | :[[image:Bar_HeatMap.png]] | ||
+ | |||
+ | :[[image:Bar_HeatMap2.png]] | ||
+ | |||
+ | == Requirements == | ||
The requirements for a heat map are | The requirements for a heat map are | ||
* The indexes for both axes must be categorical. | * The indexes for both axes must be categorical. | ||
Line 10: | Line 15: | ||
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. | 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 <code>Color_range</code> with the five labels: | |
− | + | :[[image:heat map color range.png]] | |
− | + | Then you create a table, <code>Bound</code>, with the lower bound of each range: | |
− | + | :[[image:heat map bound.png]] | |
− | + | You then use this to discretize the continuous correlations using [[StepInterp]]. | |
− | + | :<code>StepInterp(Bound, Color_range, Abs(Correlation_matrix), Color_range, leftLookup: True)</code> | |
− | [[image:heat map table.png]] | + | The result is a 2-D array of labels: |
+ | |||
+ | :[[image:heat map table.png]] | ||
When you create a heat map, you are actually graphing textual (or at least categorical) labels. | When you create a heat map, you are actually graphing textual (or at least categorical) labels. | ||
− | Once you have a result that satisfies the requirements, you | + | == Configuring the graph == |
− | # | + | |
− | # | + | Once you have a result that satisfies the requirements, you create the heat map graph: |
− | # | + | # Show the result graph |
− | #. Set '''Key''' to be your main value. Set the '''Horizontal Axis''' and '''Vertical Axis''' to the two indexes. | + | # Double-click on the graph to go to graph setup. |
− | # | + | # Select Bar style. Set Overlap to 100%. Click '''Apply'''. |
+ | # Set '''Key''' to be your main value. Set the '''Horizontal Axis''' and '''Vertical Axis''' to the two indexes. Cluster should be empty. | ||
+ | # 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_Templates|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: | ||
+ | # Double-click on the background to bring up graph setup | ||
+ | # In the '''Style template:''' field at the bottom, select '''New Template'''. | ||
+ | # Type a name for the template, e.g., ''Heat map blue'' | ||
+ | #. Press '''Set Template''' | ||
+ | |||
+ | With this graph style template now created, you can create a second heat map with fewer steps: | ||
+ | # Create indexes and a variable meeting the requirements at the beginning of this page. | ||
+ | # Show the result graph, go to graph setup and select "Heat map blue" for the '''Style template'''. Press '''Apply'''. | ||
+ | # Set '''Key''' to be your main value. Set the '''Horizontal Axis''' and '''Vertical Axis''' to the two indexes. Cluster should be empty. | ||
+ | # 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, | ||
+ | # create a new variable, <code>Va1</code>, define it as [[Time]] | ||
+ | # show its graph and double-click to [[Graph setup dialog|Graph Setup]]. | ||
+ | # Select '''New Template''' in the '''Style Template''' control at the bottom and type a name, say <code>Blue heat colors</code> | ||
+ | # Press '''Set Template''' | ||
+ | # Delete <code>Va1</code> -- you're done with it. | ||
+ | #*At this point, <code>blue heat colors</code> has been created as a new graph style template, but is empty, since <code>Va1</code> had no graph settings configured. | ||
+ | # Show your heat map graph and double-click to its Graph Setup. | ||
+ | # Set '''Style Template''' to <code>Blue heat colors</code> and press '''Apply''' | ||
+ | # Right-click on a colored block on the graph and select '''Change Series Colors...''' | ||
+ | # 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 <code>Blue heat colors</code> and press '''Apply'''. | ||
+ | |||
+ | == Download an example == | ||
Download a [[media:Heat map.ana|Heat map.ana]] example model. | Download a [[media:Heat map.ana|Heat map.ana]] example model. | ||
− | = | + | ==History== |
+ | Introduced in [[Analytica 4.6]]. | ||
+ | == See Also == | ||
+ | * [[media:Heat map.ana|Heat map.ana]] | ||
+ | * [[Graph settings]] | ||
+ | * [[Graph setup dialog]] | ||
+ | * [[Graph Style Templates]] | ||
+ | * [[Contour/Region Charts]] | ||
+ | * [[Stacked clustered bar charts]] | ||
* [[Analytica_Modelers_Guide#Mini-Tutorials|Mini-Tutorials]] where other esoteric graph types are described. | * [[Analytica_Modelers_Guide#Mini-Tutorials|Mini-Tutorials]] where other esoteric graph types are described. |
Latest revision as of 23:48, 16 February 2016
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:
Then you create a table, Bound
, with the lower bound of each range:
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:
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:
- Show the result graph
- Double-click on the graph to go to graph setup.
- Select Bar style. Set Overlap to 100%. Click Apply.
- Set Key to be your main value. Set the Horizontal Axis and Vertical Axis to the two indexes. Cluster should be empty.
- 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:
- Double-click on the background to bring up graph setup
- In the Style template: field at the bottom, select New Template.
- Type a name for the template, e.g., Heat map blue
- . Press Set Template
With this graph style template now created, you can create a second heat map with fewer steps:
- Create indexes and a variable meeting the requirements at the beginning of this page.
- Show the result graph, go to graph setup and select "Heat map blue" for the Style template. Press Apply.
- Set Key to be your main value. Set the Horizontal Axis and Vertical Axis to the two indexes. Cluster should be empty.
- 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,
- create a new variable,
Va1
, define it as Time - show its graph and double-click to Graph Setup.
- Select New Template in the Style Template control at the bottom and type a name, say
Blue heat colors
- Press Set Template
- 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, sinceVa1
had no graph settings configured.
- At this point,
- Show your heat map graph and double-click to its Graph Setup.
- Set Style Template to
Blue heat colors
and press Apply - Right-click on a colored block on the graph and select Change Series Colors...
- 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
- Heat map.ana
- Graph settings
- Graph setup dialog
- Graph Style Templates
- Contour/Region Charts
- Stacked clustered bar charts
- Mini-Tutorials where other esoteric graph types are described.
Enable comment auto-refresher