Uses the number of columns and number of rows in a heatmap to fix the aspect ratio such that the cells are perfectly square.

Usage

make_square(p, fudge = 1)

Arguments

p
a ggplot object with discrete x and y aesthetics set
fudge
a fudge factor multiplying the aspect ratio (< 1 = wider, > 1 = taller). This does not appear to work right now.

Value

the same object, with the aspect ratio fixed to be the (number of rows)/(number of columns)

Description

Uses the number of columns and number of rows in a heatmap to fix the aspect ratio such that the cells are perfectly square.