# Rename a specific tick label

**URL:** <https://forum.generic-mapping-tools.org/t/rename-a-specific-tick-label/5018>\
**Category:** PyGMT Q&A\
**Created:** [June 25, 2024, 2:14pm UTC](https://forum.generic-mapping-tools.org/t/rename-a-specific-tick-label/5018 "2024-06-25T14:14:19Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [June 25, 2024, 2:45pm UTC](https://forum.generic-mapping-tools.org/t/rename-a-specific-tick-label/5018/4 "2024-06-25T14:45:39Z")

</div>

using custom ticks mechanism of gmt:

```auto
import pygmt

#The coord is the location of the desired annotation, tick, or grid-line,
#whereas type is a string composed of letters from
#a (annotation), i interval annotation, f frame tick, and g gridline.
#You must use either a or i within one file; no mixing is allowed.
#The coordinates should be arranged in increasing order.
#If label is given it replaces the normal annotation based on the coord value.

xannots = '''5 ag 5 Station
10 ag 10 Station
15 ag 20 Station
'''

with open('xannots.txt', 'w') as f:
    f.writelines(xannots)

fig = pygmt.Figure()
with fig.subplot(nrows=1,ncols=1,subsize=("16c", "10c")):
    pen = "1.5p"
    with fig.set_panel(panel=0):
        fill = "skyblue"
        offset=0.6
        colr='yellow'
        fig.basemap(region=[3, 18, 0, 8], frame=['pxcxannots.txt'])
        fig.plot(x=5+offset, y=5, style="b1c", fill=fill, pen=pen)
        fig.plot(x=5-offset, y=3, style="b1c", fill=colr,pen=pen)
        fig.plot(x=10+offset, y=6, style="b1c", fill=fill, pen=pen)
        fig.plot(x=10-offset, y=7, style="b1c", fill=colr,pen=pen)
        fig.plot(x=15+offset, y=2, style="b1c", fill=fill, pen=pen)
        fig.plot(x=15-offset, y=3, style="b1c", fill=colr,pen=pen)

fig.savefig('custom_xticks.png', show=True)

```

---

_[View the full topic](https://forum.generic-mapping-tools.org/t/rename-a-specific-tick-label/5018)._
