Labels on vertical colorbar?

I am trying to create a plot with a colorbar. Since I want uniform, nicely rounded labels, I use a custom label file I create with entries like:

5.0235328493782 a 5

This works as desired when plotting a horizontal colorbar, using a position parameter of JBC and a frame parameter of pxc<filename> However, if I switch to a vertical colorbar by changing the position parameter to JMR, all but the first label disappear.

How might I fix this?

That sounds like a bug. Would you be able to post a but report on GitHub and supply a stripped down script (e.g., just a coast plot instead of grid, make cpt and then your custom table and the colorbar plot) to simplicy debugging for me?

Apparently I am able to do that: https://github.com/GenericMappingTools/pygmt/issues/1557
:slight_smile:

Here’s the translated GMT code

cat << EOF >| annots.txt
0 a 0
5 a 5
10 a 10
15 a 15
20 a 20
EOF

gmt begin colorbarexample png
    gmt basemap -JM10i -R-180/-142.119/48.225/65.694 -BWeSn -Bafg
    gmt coast -S#CBE7FF -Df
    gmt makecpt -Cjet -T0/20

    gmt colorbar -DJMR -Bpxcannots.txt
    gmt colorbar -DJBC -Bpxcannots.txt
gmt end show

produces

1 Like