Replaced tick label in barplot


fig = pygmt.Figure()

with fig.subplot(
    subsize=("15c", "10c"),
    frame=["WSne", "x+lPlace", "y+l# Fight"],     
    margins=["0.5c", "0.75c"],
    pen = "1.5p"

    with fig.set_panel(panel=0):
        fill = "blue"
        fig.basemap(region=[0, 4, 0, 15], frame="+t Tom vs Jerry")
        fig.plot(x=1+offset, y=10, style="b1c", fill=fill, pen=pen)
        fig.plot(x=1-offset, y=9,  style="b1c", fill=colr,pen=pen)     
        fig.plot(x=3+offset, y=5, style="b1c", fill=fill, pen=pen, label="Tom")
        fig.plot(x=3-offset, y=12,  style="b1c", fill=colr,pen=pen, label="Jerry")        
        fig.legend(position="JBL+jTR+o0.7c", box="+gwhite+pblack")

How can I replaced the tick label to “Kithcen”, and “Backyard”.
Also, how can I add grid lines.

Thank you!

you likely need this approach 4.3.8. Custom axes

@mkononets thank you for the link. Do you have any suggestions or link on converting GMT to pygmt codes.

Thank you

4.3.8. Custom axes example translated to pygmt

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 = '''416.0 ig Devonian
443.7 ig Silurian
488.3 ig Ordovician
542 ig Cambrian
yannots = '''0 a
1 a
2 f
2.71828 ag e
3 f
3.1415926 ag @~p@~
4 f
5 f
6 f
6.2831852 ag 2@~p@~


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

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

fig = pygmt.Figure()
region = '416/542/0/6.2831852'
projection = 'X-12c/6c'
frame = ['px25f5g25+u Ma', 'pycyannots.txt', 'sxcxannots.txt', 'WS+glightblue' ]
    fig.basemap(region=region, projection=projection, frame=frame)

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