# pyGMT gridlines going over lat, long labels

**URL:** <https://forum.generic-mapping-tools.org/t/pygmt-gridlines-going-over-lat-long-labels/6031>\
**Category:** PyGMT Q&A\
**Tags:** gmt\
**Created:** [July 3, 2025, 1:17am UTC](https://forum.generic-mapping-tools.org/t/pygmt-gridlines-going-over-lat-long-labels/6031 "2025-07-03T01:17:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tw21](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@tw21](https://forum.generic-mapping-tools.org/u/tw21)\
**Post date:** [July 3, 2025, 1:17am UTC](https://forum.generic-mapping-tools.org/t/pygmt-gridlines-going-over-lat-long-labels/6031/1 "2025-07-03T01:17:09Z")

</div>

I’ve got a simple map with some custom gridlines. The gridlines go through the latitude and longitude labels. However, the lines go through the text. How can I adjust the labels to move lat slightly above the line and lon slightly next to the line. The config offsets in docs don’t seem to do that.

```auto
with pygmt.config(FONT=f"{size_scale*2}p,{FONT}", MAP_FRAME_TYPE="inside", MAP_GRID_PEN_PRIMARY="0.1p,black"):
    fig.basemap( 
        # justify='bl',
        region=region_map,
        projection="M12c", # Mercator projection with a width of 12 centimeters
        frame=["af+s25p/25p/gray30", 'x1g1', 'y1g1']
    )

```

example image:

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/4/43a9a92aca20067b969d0a66f9834476a12dfc80.png)

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [July 4, 2025, 8:59am UTC](https://forum.generic-mapping-tools.org/t/pygmt-gridlines-going-over-lat-long-labels/6031/2 "2025-07-04T08:59:24Z")

</div>

From what I understand one cannot just configure tick labels the way you want it.

You could however instead use custom tick/label mechanism of GMT. You’d need to create a custom annotation file per axis and separately indicate annotation labels with an offset and gridlines at the exact positions, like

```auto
...
# gridline at an exact position:
23.0 g
# annotation with a suitable offset
23.1 a 23°00'N
# you'd have to manually format annotations with the degree char and the hemisphere char
# this may be another quest
...

```

Examples/docs:  
[forum link](http://forum.generic-mapping-tools.org/t/rename-a-specific-tick-label/5018/4)  
[GMT docs](https://docs.generic-mapping-tools.org/latest/reference/options.html#custom-axes)
