liveBook · Manning

Heat map

As explained in Statistics Slam Dunk

A heat map is a diagram that encodes data values with colors or shades arranged across a two-dimensional layout.

A heat map encodes data values with colors or shades arranged across a two-dimensional layout. For correlation analysis, each tile represents the relationship between two continuous variables, making strong, weak, and near-zero associations easy to compare. section 2.5.4

Build a correlation heat map in R by preparing the data, reshaping the matrix, and mapping coefficients to tiles:

  • Select only continuous variables, such as Age, G, MP, WS, and WS48, because correlation coefficients require continuous data. section 2.5.4
  • Pass the selected data to cor() to create a correlation matrix; the matrix repeats each variable pair across two symmetrical positions. section 2.5.4
  • Use melt() to convert the matrix into Var1, Var2, and value columns, then use ggplot2 geom_tile() to draw colored cells. section 2.5.4
  • Add a diverging fill scale from -1 to 1 and label tiles with rounded coefficients so color and numeric value reinforce each other. section 2.5.4

NBA draft correlations

A correlation heat map of first-round draft data compares Age, games played, minutes played, win shares, and win shares per 48 minutes. The matrix shows, for example, a correlation of about 0.66 between MP and WS48 and about 0.80 between G and WS. These patterns reveal association, not causation: a strong correlation does not prove that one variable influences another. section 2.5.4 section 2.7

How Statistics Slam Dunk covers it

How deep it goes
Explains data selection, matrix computation, reshaping, tile mapping, labeling, and correlation limits without covering advanced analysis.
Examples
Uses NBA draft variables including Age, games, minutes, win shares, and win shares per 48 minutes.
What it assumes
Assumes basic R data manipulation and introduces continuous-variable selection, correlation matrices, reshaping, and visual encoding.
What you can do after
Builds a correlation heat map in R with cor(), melt(), ggplot2, geom_tile(), and labeled color-scaled coefficients.
How it connects
Connects correlation coefficients, correlation matrices, continuous variables, data wrangling, ggplot2, and causation.

Also explained in

Compare how 7 books explain heat map →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Slam Dunk. The section links point to the parts of the book it draws on.