updated the heatmap script to work both in 2D and 3D mode