Turn off automatic font size for color bars

Dear fellow GMT users,
I recently installed the latest GMT version on a new computer and ran older scripts (older but still GMT6). Now labels on color bars are scaled relative to the axes labels (i.e., they are much smaller). I prefer to control the font size myself but don’t find a way to turn this off. Changing the defaults using “gmt set” doesn’t help. Any suggestions?
Thanks!

Classic mode or modern? Maybe play with different GMT_THEME, I think the modern and minimal themes cause auto scaling.

I have tried but changing to classic doesn’t help either.

Yes. A (non) working example.

An example will help as @Joaquim says.

See GMT Themes — GMT 6.6.0 documentation. Both modern and minimal auto scales a lot of settings.

Maybe this can help, Gmt not reading FORMAT_GEO_MAP from gmt.conf - #11 by Andreas?

Here’s the script:
gmt begin SWBaltic

gmt set GMT_THEME classic FONT_ANNOT 12p MAP_FRAME_TYPE plain -JM8c -R9.785/10.6/54.26/54.83

gmt makecpt -Cabyss -T0/50/2 -Iz -H > contour_3.cpt

gmt basemap -Bx0.5g0 -Bya0.25g0 -BWesN

gmt coast -Df -W0.3p -Wblack -Ggray90 -A2000

gmt colorbar -Dx4.5c/+1.0c+w3c/0.3ch -Ccontour_3.cpt -B10 -B+l"Water depth (m)"

gmt basemap -R+7.7/+13.7/+53.5/+57.9 -JM2.2c -Bx0.0g0 -Bya0.0g0 -Bwesn

gmt coast -Dh -W0.3p,black -A2000 -Ggray80 -Swhite

gmt end show

I also copied the modern file in the theme folder, changed all fonts to 12p, renamed it and called it with GMT_THEME. Same unsatisfying result.

Sorry, but please make it a minimal example. Often one liner is all it takes to show the issue.

Here’s a simple example. In the custom theme all fonts are set to 12p. I can modify the frame by changing to plain but I don’t see how I can turn off automatic labeling. Turning off GMT_THEME altogether doesn’t work either.

gmt begin example

gmt set GMT_THEME custom FONT_ANNOT 12p MAP_FRAME_TYPE plain -JM8c -R9.785/10.6/54.26/54.83

gmt makecpt -Cabyss -T0/50/2 -Iz -H > example.cpt

gmt basemap -Bx0.5g0 -Bya0.25g0 -BWesN

gmt colorbar -Dx4.5c/+1.0c+w3c/0.3ch -Cexample.cpt -B10 -B+l"Water depth (m)"

gmt end show

This is a one-liner

gmt colorbar -Dx7.5c/-.85c+w14c/0.15c+jTC+h+e -F+gwhite -B.1g.2 -B+tcontinuous -Cjet -Bx -By+lmm/day --FONT_ANNOT=20 -png lixo

Thanks for the illustration. I added additional lines (base map) to demonstrate the different font size between axes and colorbar labels.

Try removing FONT_ANNOT 12p from your set command and add --FONT_ANNOT_PRIMARY=46p to your colorbar call.

Thanks a lot! The numbers were larger but the title was still small. Using --FONT instead of --FONT_ANNOT_PRIMARY changes both.

1 Like

Hi, I don’t believe this is a complete solution. Even with a command such as

gmt colorbar -Ctmp.cpt -DJCB+w14c/0.4c+h+e -Bxa0.1+l"correlation"
–FONT_ANNOT_PRIMARY=14p --FONT_LABEL=14p

I still find that the font scales automatically with the width of the bar, even when there is sufficient space, which is not ideal for consistency. Is it not possible specify the colour bar font size absolutely? I’m sure I used to be able to in GMT5 (I’ve only just switched to GMT6 so learning again!).

gmt colorbar -Ctmp.cpt -DJCB+w14c/0.4c+h+e -Bxa0.1+l"correlation" –FONT_ANNOT_PRIMARY=14p --FONT_LABEL=14p -png lixo
colorbar [ERROR]: Option -DJ requires the -R option
colorbar [ERROR]: No input files are allowed