Ken Kleinman

Biostatistician

  • Increase font size
  • Default font size
  • Decrease font size

Heat map/ binned scatterplot/Two-D histogram

E-mail Print PDF

The TWODHIST macro makes a binned scatterplot, also known as a heat map or a two-dimensional histogram.This is effectively a scatterplot with squares plotted and shaded to reflect the count in each square.

It uses proc gmap to do this-- a more sophisticated and doubtless more flexible approach would use proc template and proc sgplot.

Use:

Parameters:
data      Input data set
x         variable to be plotted on the x-axis
y         variable to be plotted on the y-axis
nbinsx    number of categories to divide x into
nbinsy    number of categories to divide y into
nshades   number of levels of the count of the population in each square

The code has a number fo flaws and limitattions I know of, which are described within the code.  Doubtless there are additional problems I know not of.

 

Contents