heatmap_dims(p)
This works by identifying the number of unique points in the variables mapped to the x and y axes.