# Integrating a heatmap into a table

Created 2019-08-27.

Redesigning a table to integrate a heatmap to show high level structure, while keeping text values for detailed structure.

The original table is from a arXiv paper, Proximity-based equivalence classes in fuzzy relational database model.

I immediately saw two problems with the design of the original table:

- The cells of the original table center their text, but it would be easier to read if the cells were aligned on the decimal point.
- The cells contain different numbers of digits after the decimal point: some cells contain no digits after the decimal point, some cells contain one digit after the decimal point, and some cells contain two digits after the decimal point. Using a consistent number of digits after the decimal point reduces the textual variation of the table and allows for easier reading and comparison of values between cells.

I address this by aligning the cells on the decimal point and consistently using two digits after the decimal point. To see a redesign of the table that just addresses these issues see the "conservative redesign" figure.

In addition to these two issues, there's also no way to see the general structure of the values shown in the table. I address this by combining a heat map with textual information present in the original table. One can see the visualizing the value of the cells using color mix the structure of the values in the table very clear: the values are always the same in diagonals.

Created this graphic in R using the ggplot2 library. Because the column names in the original table are the same as the row names, I created an ordered categorical variable that ordered the categories using the ordering and the original table. I used the viridis color scale in the fill values of the heat map layer and I layered text labels representing the numeric values of the cell on top of the heat map.

Sadly, I lost the code that I used to generate this graphic.