The cpt file has already been briefly mentioned in connection with our seismicity plot in session 2. Here we will treat the issue in more detail. The general format of cpt files is
z0 | Rmin | Gmin | Bmin | z1 | Rmax | Gmax | Bmax | [ A] |
... | ||||||||
zn-2 | Rmin | Gmin | Bmin | zn-1 | Rmax | Gmax | Bmax | [ A] |
Since a cpt file may contain only shades of gray (here listed as the red component), the green and blue columns are optional and only used for color tables. An optional final column may be used to affect annotation of color bars (created by psscale ). The U, L, and B flags (position A) indicate we want to annotate the upper, lower, and both color boundaries, respectively. Alternatively, you can use the psscale -–B option in the same way you use it in, say, psbasemap .
Cpt files can be created in any number of ways. GMT provides two mechanisms:
One can also make these files manually or with awk or other tools. Here we will limit our discussion to makecpt . Its main argument is the name of the master color table (a list is shown if you run the program with no arguments) and the equidistant z-values to go with it. The main options are given below.
|
To make discrete and continuous color cpt files for data that ranges from -20 to 60, with color changes at every 10, try these two variants:
makecpt -Crainbow –-T-20/60/10 –>! disc.cpt makecpt –-Crainbow -T-20/60/10 -–Z >! cont.cpt
We can plot these color tables with psscale ; the options worth mentioning here are listed in Table 4.2.
|
In addition, the -–B option can be used to set the title and unit label (and optionally to set the anotation-, tick-, and grid-line intervals for the colorbars.)
psbasemap -R0/8.5/0/11 -Jx1i -P -B0 -K >! bar.ps psscale -–D3i/3i/4i/0.5ih –-Cdisc.cpt –-B:discrete: -–O –-K >> bar.ps psscale –-D3i/5i/4i/0.5ih –-Ccont.cpt –-B:continuous: –-O -–K >> bar.ps psscale –-D3i/7i/4i/0.5ih –-Cdisc.cpt –-B:discrete: –-I0.5 –-O –-K >> bar.ps psscale –-D3i/9i/4i/0.5ih –-Ccont.cpt –-B:continuous: –-I0.5 -–O >> bar.ps