Colorbar box and annotation

Hi all, I am having a problem in drawing the colorbar, the border range of the colorbar is not enough as shown below, this is my code and my cpt

import pygmt

fig = pygmt.Figure()
cpt_path = 'Blues_09.cpt'
pygmt.makecpt(cmap=cpt_path,
              background='o',
              )
fig.basemap(region=[0,5,0,10], projection='M5c', frame='af')
with pygmt.config(FONT_ANNOT_PRIMARY='5p',
                  FONT_LABEL='10p'
                  ):
    fig.colorbar(cmap=True,
                 # position='ML+w5c/0.5c+ef+v',
                 position='jBL+w5c/0.5c+o0.3c+ef+v',
                 frame=['y+lm'],
                 box='+gwhite+p0.8,black',
                 equalsize='i',
                 )
fig.show()

Blues_09.cpt

image
Also, I would like to know if it is possible to set the min-max labeling of the colorbar to something like ‘<10’ or ‘>500’ as shown in the picture.Thanks for the help!

Some workarounds until such time we improve this general situation:

  1. See the clearance modifier +c to the box settings.
  2. As for < and > on the first and last box: the equalsize directive turns on the categorical label format and we have no modifier for treating those two boxes differently. So here you would need to add the labels in the CPT itself.

On the command line, I did this to get the right size box since GMT did not consider teh XXX-YYY label format will clearly need more space. I will look into fixing that but setting larger clearance is the workaround::

gmt colorbar -CBlues_09.cpt -F+p1p+c2p/28p/2p/2p -Dx3i/3i+w4i+v -Li -pdf bar

Thank you for your reply! It has resolved the issue I was having :grinning:.