Error plotting heatmap

Are you appending the grdimage output to some earlier part of the plot with -O? -O means add another layer. If there is nothing before then no -O. But you are appending (>>) so unclear what you are doing, but sounds like there is no PostSCript header from a previous call.