next up previous contents index
Next: 7.20 Custom plot symbols Up: 7. Creating GMT Graphics Previous: 7.18 Volumes and Spatial   Contents   Index


7.19 Color patterns on maps

GMT 3.1 introduced color patterns and this examples give a few cases of how to use this new feature. We make a phony poster that advertises an international conference on GMT in Honolulu. We use grdmath, makecpt, and grdimage to draw pleasing color backgrounds on maps, and overlay pscoast clip paths to have the patterns change at the coastlines. The middle panel demonstrates a simple pscoast call where the built-in pattern # 86 is drawn at 100 dpi but with the black and white pixels replaced with color combinations. At the same time the ocean is filled with a repeating image of a circuit board (provides in Sun raster format). The text GMT in the center is an off-line PostScript file that was overlaid using psimage. The final panel repeats the top panel except that the land and sea images have changed places (Figure 7.19).




#!/bin/sh
#               GMT EXAMPLE 19
#
# Purpose:      Illustrates various color pattern effects for maps
# GMT progs:    gmtset, grdimage, grdmath, makecpt, pscoast, pstext, psimage
# Unix progs:   rm
#
ps=example_19.ps

# First make a worldmap with graded blue oceans and rainbow continents

gmtset COLOR_MODEL rgb
grdmath -Rd -I1 Y COSD 2 POW = lat.nc
grdmath -Rd -I1 X Y ABS 90 NEQ MUL = lon.nc
echo "0 white 1 blue" > lat.cpt
makecpt -Crainbow -T-180/180/60 -Z > lon.cpt
grdimage lat.nc -Sl -JI0/6.5i -Clat.cpt -P -K -Y7.5i -B0 > $ps
pscoast -R -J -O -K -Dc -A5000 -Gc >> $ps
grdimage lon.nc -Sl -J -Clon.cpt -O -K >> $ps
pscoast -R -J -O -K -Q >> $ps
pscoast -R -J -O -K -Dc -A5000 -Wthinnest >> $ps
echo "0 20 32 0 1 CM 9TH INTERNATIONAL" | pstext -R -J -O -K -Gred -Sthinner >> $ps
echo "0 -10 32 0 1 CM GMT CONFERENCE" | pstext -R -J -O -K -Gred -Sthinner >> $ps
echo "0 -30 18 0 1 CM Honolulu, Hawaii, April 1, 2011" | pstext -R -J -O -K -Ggreen -Sthinnest >> $ps

# Then show example of color patterns and placing a PostScript image

pscoast -R -J -O -K -Dc -A5000 -Gp100/86:FredByellow -Sp100/circuit.ras -B0 -Y-3.25i >> $ps
echo "0 30 32 0 1 CM SILLY USES OF" | pstext -R -J -O -K -Glightgreen -Sthinner >> $ps
echo "0 -30 32 0 1 CM COLOR PATTERNS" | pstext -R -J -O -K -Gmagenta -Sthinner >> $ps
psimage -C3.25i/1.625i/CM -W3i GMT_covertext.eps -O -K >> $ps

# Finally repeat 1st plot but exchange the patterns

grdimage lon.nc -Sl -J -Clon.cpt -O -K -Y-3.25i -B0 -U"Example 19 in Cookbook" >> $ps
pscoast -R -J -O -K -Dc -A5000 -Gc >> $ps
grdimage lat.nc -Sl -J -Clat.cpt -O -K >> $ps
pscoast -R -J -O -K -Q >> $ps
pscoast -R -J -O -K -Dc -A5000 -Wthinnest >> $ps
echo "0 20 32 0 1 CM 9TH INTERNATIONAL" | pstext -R -J -O -K -Gred -Sthinner >> $ps
echo "0 -10 32 0 1 CM GMT CONFERENCE" | pstext -R -J -O -K -Gred -Sthinner >> $ps
echo "0 -30 18 0 1 CM Honolulu, Hawaii, April 1, 2011" | pstext -R -J -O -Ggreen -Sthinnest >> $ps

rm -f l*.nc l*.cpt .gmt*


Figure 7.19: Using color patterns and additional PostScript material in illustrations.
\includegraphics[width=0.9\textwidth]{scripts/example_19}


next up previous contents index
Next: 7.20 Custom plot symbols Up: 7. Creating GMT Graphics Previous: 7.18 Volumes and Spatial   Contents   Index
Paul Wessel 2010-07-14