Question about making a cross-section with grdimage

Hi there,

Using the following xyz file xyz_example.txt (165 Bytes) and the two following commands:

awk '{print $1, 6370-$2, $3}' xyz_example.txt| gmt surface -R0/5/6280/6370 -I5m/10k

gmt grdimage -Baf -B+t -R0/5/6280/6370  -JPa30z -pdf cross_section

I am able to create a cross-section that looks like that:
cross_section.pdf (8.0 KB)

I was wondering whether there is a way to make the grids follow the curvature of the plot’s frame (so there are no gaps in the plot’s edges).

Just pick smaller gridding increments until it does not bother you anymore, e.g., -I1m/1

Have you try selecting a region (in surface) slightly bigger than the one use for grdimage?

Use -R0/6/6270/6380

awk '{print $1, 6370-$2, $3}' xyz_example.txt| gmt surface -R0/6/6270/6380 -I5m/10k
gmt grdimage -Baf -B+t -R0/5/6280/6370  -JPa30z -png cross_section

Thanks a lot for the help!
In the case I would want to use xyz2grd like below (with larger grinding increments):

awk '{print $1, 6370-$2, $3}' xyz_example.txt| gmt xyz2grd -R0/5/6280/6370 -I50m/20k
gmt grdimage -Baf -B+t -R0/5/6280/6370  -JPa30z  -png cross_section

That gives the following:

I was wondering if there is a way to plot the grids/cells looking something like the image below?

You would need grdview -T for that.

Unfortunately grdview -T has a bug if -C is not given so you will need to create a CPT and pass it via -C for this to work until the bug fix is merged ( I just submitted a PR).

Thanks again, grdview -T works great!