Help with creating a region of mean magnitudes

I’m trying to create an earthquake map of b values.
I have a .txt file with all the longitudes, latitudes and magnitudes and i want to split the map up into regions of 1 degree x 1 degree and add the mean magnitude of each region in. what gmt function would be the best to use for this? im new at gmt and im very confused with all the converting to xyz and grid stuff.
would blockmean be a good one to use?

I think gmtbinstat would be a more sensible approach. Have a look at the documentation plus you can have some inspiration from this post

ill have a look, thank you so much

sorry about this, its probably a stupid question but since my data file is currently .txt, do i need to turn it into a .grd in order to set the 1x1 degree regions? and also how do i do that

Well… have a proper look at the example I’ve given you, it’s a 1:1 reproduction of your case.
The data are in text file too, so not gridded. The -I flag makes the gridding for the processed values.

ah sorry my bad i didnt see the whole thing haha. thank you so so much