Made error catching across heatmap analyses consistent

Also fixed bug where cairo graphical device was not properly
instantiated before plotting the error.