How to create a heatmap

If you have a good data density, you can play with the bin size, and you need a more continuous colorbar (makecpt).
Ultimately you can apply grdfilter after gmtbinstats

just to make sure, the gmtbinstats replace the xyz2grd function in your example, right?

Yep.
Have a look at the thread, thereā€™s a second script :wink:

Did you try adding -rp option to produce pixel registered grid (instead of default grid line registration)? My idea is to avoid shifting grid lines when plotting, but IDK whether it actually works the way I imagine it.

Cannot try myself as the data havenā€™t been posted.

Yes it does, changing grid registration to pixel with -rp makes the grid to match the grid lines without manual shifting, checked with some of my own data.

UPD xyz2grd -A... -rp produces essentially a different grid in a way that many data points fall into neighboring grid cells when grid registration is changed from gridline to pixel.