next up previous contents index
Next: A 3-D illuminated surface Up: Cook-book Previous: Spectral estimation and xy-plots

   
A 3-D perspective mesh plot

This example will illustrate how to make a fairly complicated composite figure. We need a subset of the ETOPO5 bathymetry†6.1 and Geosat geoid data sets which we will extract from the local data bases using grdraster . We would like to show a 2-layer perspective plot where layer one shows a contour map of the marine geoid with the location of the Hawaiian islands superposed, and a second layer showing the 3-D mesh plot of the topography. We also add an arrow pointing north and some text. This is how to do it:





#!/bin/csh
#        GMT EXAMPLE 04
#
#        @(#)job04.csh    1.6  01/05/99
#
# Purpose:    3-D mesh plot of Hawaiian topography and geoid
# GMT progs:    grdcontour, grdview, pscoast, pstext, psxyz
# Unix progs:    echo, rm
#
echo '-10     255     0       255' >! zero.cpt
echo '0       100     10      100' >> zero.cpt
grdcontour geoid.grd -Jm0.45i -E60/30 -R195/210/18/25 -C1 -A5 -G4i -K -P -X1.5i -Y1.5i \
   -U/-1.25i/-1.25i/"Example 4 in Cookbook" >! example_04.ps
pscoast -Jm -E60/30 -R -B2/2NEsw -G0 -O -K >> example_04.ps
echo '205 26 0 0 1.1' | psxyz -Jm -E60/30 -R -SV0.2i/0.5i/0.4ii -W1p -O -K -N >> example_04.ps
echo '205 29.2 36 -90 1 5 N' | pstext -Jm -E60/30 -R -O -K -N >> example_04.ps
grdview topo.grd -Jm -Jz0.34i -Czero.cpt -E60/30 -R195/210/18/25/-6/4 -N-6/200/200/200 -Qsm -O -K \
   -B2/2/2:"Topo (km)":neswZ -Y2.2i >> example_04.ps
echo '3.25 5.75 60 0.0 33 2 H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> example_04.ps
\rm -f zero.cpt
csh job4c.csh





The purpose of the color palette file zero.cpt is to have the positive topography mesh painted light gray (the remainder is white). Figure 6.4 shows the complete illustration.

  
Figure 6.4: 3-D perspective mesh plot
\begin{figure}\centering\epsfig{figure=eps/GMT_example_04.eps}\end{figure}

A color version of this figure was used in our first article in EOS Trans. AGU (Oct. 8th, 1991). It was created along similar lines, but instead of a mesh plot we chose a color-coded surface with artificial illumination from a light-source due north. We choose to use the -Qi option in grdview  to achieve a high degree of smoothness. Here, we select 100 dpi since that will be the resolution of our final raster (The EOS raster was 300 dpi). We used grdgradient  to provide the intensity files. The following script creates the color PostScript file. Note that the size of the resulting output file is directly dependent on the square of the dpi chosen for the scanline conversion. A higher value for dpi in -Qi would have resulted in a much larger output file. The cpt files were taken from Example 2.





#!/bin/csh
#        GMT EXAMPLE 4c
#
#        @(#)job4c.csh    1.7  01/31/99
#
# 3-D perspective color plot of Hawaiian topography and geoid
# GMT progs:    grdcontour, grdview, pscoast, pstext, psxyz
# Unix progs:    echo, rm
#
grdgradient geoid.grd -A0 -Gg_intens.grd -Nt0.75 -M
grdgradient topo.grd -A0 -Gt_intens.grd -Nt0.75 -M
#
grdview geoid.grd -Ig_intens.grd -JM6.75i -E60/30 -R195/210/18/25 -Cgeoid.cpt -Qi100 -K -X1.5i \
   -Y1.25i -P -U/-1.25i/-1i/"Example 4c in Cookbook" >! example_4c.ps
pscoast -JM -E60/30 -R -B2/2NEsw -G0 -O -K >> example_4c.ps
echo '205 26 0 0 1.1' | psxyz -JM -E60/30 -R -SV0.2i/0.5i/0.4ii -W1p -G255/0/0 -O -K -N \
   >> example_4c.ps
echo '205 29.2 36 -90 1 5 N' | pstext -JM -E60/30 -R -O -K -N >> example_4c.ps
grdview topo.grd -It_intens.grd -JM -JZ3.4i -Ctopo.cpt -E60/30 -R195/210/18/25/-6/4 \
   -N-6/200/200/200 -Qi100 -O -K -Y2.2i >> example_4c.ps
psbasemap -JM -JZ3.4i -E60/30 -R -Z-6 -O -K -B2/2/2:"Topo (km)":neZ >> example_4c.ps
echo '3.25 5.75 60 0.0 33 2 H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> example_4c.ps
\rm -f *_intens.grd .gmtcommands





 


next up previous contents index
Next: A 3-D illuminated surface Up: Cook-book Previous: Spectral estimation and xy-plots
Paul Wessel
1999-07-01