Call to colorbar hangs script

I have a working script that freezes when I call colorbar. The script run perfectly when I comment out the colobar line. I’m running 6.1.1 on MacOSX 10.14.6

sample from script:
gmt begin bcdmap1
gmt grdimage @earth_relief_01s -R-20/20/-20/20+uk -JM-106.9563713/34.05913412/30c -Cregion.cpt
gmt colorbar -Dx8c/1c+w12c/0.5c+jTC+h
gmt end show

There is a space between - and Cregion.cpt in your call to grdimage. Since -C is not set in grdimage, colorbar reads from standard input.


Looks like that space was a typo from pasting the code. It’s not in my actual script and the issue remains.

A similar problem could occur if GMT cannot find region.cpt. Is this file in your working directory?

@maxrjones yes it is the working directory

Does the script work if you replace the colorbar command with the line below?

gmt colorbar -Dx8c/1c+w12c/0.5c+jTC+h -Cregion.cpt

1 Like

So…step in the right direction. No hanging the script, but I’m getting black colorbars??

I was under the impression that if I had used -Cregion.cpt in the session gmt would recognize and continue to use that. Didn’t seem to be the case here.

Additionally, why black instead of using the region.cpt colormap?

Yes, your interpretation of modern mode colormaps is correct. I will look into the problem there but this should provide an immediate solution.

Can you share region.cpt? It is not possible to tell why the colorbar is black without more information.

1 Like


Ah…the issue is that I had the region.cpt file at a ridiculously small interval
gmt makecpt -Cdem2 -D -V -T1524/3524/0.1 > region.cpt

The very fine increment was causing the colorbar to look black…I’ve changed the increment to something reasonable like 10 and the colorbar looks normal now!

Thanks for your suggestions!

Glad it works now :slight_smile: