How to modify axis annotation

Hi there,

Is there a way to change annotations of axes to what I want? For instance, I would like to modify the annotations to string instead of number. How can make it? The version of current GMT is 5.4. Thanks.


GMT 5.4 was long time ago. You should update, specially when asking for help.
(if I get your question, it, “Custom annotations”, probably did not exist in GMT5)

It’s old, I don’t remember what version of GMT I used then :

at << EOF > xannots.txt
0.5 ig J
1.5 ig F
2.5 ig M
3.5 ig A
4.5 ig M
5.5 ig J
6.5 ig J
7.5 ig A
8.5 ig S
9.5 ig O
10.5 ig N
11.5 ig D
12.5 ig

gmt grdimage [...] > $psFile
gmt psscale -[...] >> $psFile
gmt psbasemap [...] -Bpycxannots.txt [...] >> $psFile

Many Thanks. I checked online as well but did not know what the ‘i’ stands for. ‘i’ is ‘interval’ in the document, but relative to what? Could you tell me more about that?

It is for annotating intervals, e.g., July You probably want to use ag instead if you have non-interval data.

You might have read it, but see 4.3.8. Custom axes.

Fun fact: custom annotations with geographical projections was implemented in GMT 5.3.3.

Thanks Paul. Does that mean ‘a’ is a general option for all data kinds (interval and non-interval)? The interval option ‘i’ means the annotation should be equally arranged along with the axis, is that right?

Thanks for the suggestion. I found it in the manual of GMT. But I did not find the real use in 5.3.3. Actually, there is no such a part (5.3.3.) in GMT 5.4 manual. I also checked online for GMT 6.5, there was no 5.3.3. as well. Could you please specify where you found that? Regards.

Sorry, I was referring to the GMT version; GMT 5.3.3.


  • I’m using custom annotation in Animation: Planck’s law
  • Here’s a silly map for testing custom annotations. Pardon the Norwegian.

gmt pscoast -P -K -JS0/90/20c -W -R-20/40/60/70r -Slightblue -Ggray -Bafg --PS_MEDIA=A0 --MAP_ANNOT_OBLIQUE=30 -BEN -Y10c > $ps

cat << eof > temp.yannot
68 afg Iskaldt
62 afg Mildere
52 afg Litt varmt
42 afg For varmt

cat << eof > temp.xannot
-10 afg S@avidt innom Irland
0 afg Prime meridian!
33 afg Meridian for UTM36
40 afg Langst @o st
10 afg Nesten Oslo
5:44 afg Stavanger

gmt psbasemap -R -J -O -K -Byctemp.yannot -BWS --MAP_ANNOT_OBLIQUE=30 --MAP_GRID_PEN_PRIMARY=thicker,black,-.. >> $ps

gmt psbasemap -R -J -O -Bxctemp.xannot -BWS --MAP_ANNOT_OBLIQUE=8 --MAP_GRID_PEN_PRIMARY=thickest,black,. >> $ps

gmt psconvert -Tg -A -Z $ps

rm temp.yannot temp.xannot gmt.history

I see now that the x-annotations that have meridians that project into the y-axis/frame, are not annotated. Probably expected… But would be nice to have an option that would always print the annotation, regardless of x/y-frame.

Not many coordinates are interval - time is one of the fewl. Tuesday is an interval (24 hours), 00:00, start of Tuesday, is not where we place Tuesday, July 13 since that should be entered between 00:00 and 00:00 + 24 hours as an interval annotation. Almost everything else are annotations, hence a.
But remember @Joaquim’s advice about updating - there are zero good excuses to not stay updated. I know there are plenty of dumb reasons but you dont want to find yourself in that group!

Thanks for the help. The examples are quite useful and inspirational.

1 Like

Thanks for the answers. I will consider your suggestions for the updating. Thanks again.