(4) A 3-D perspective mesh plot — GMT 5.1.1 documentation

### Navigation

- index
- next
- previous
- Project Home »
- GMT 5.1.1 documentation »
- The GMT historical collection »
- Search:

# (4) 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 [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. The first part of this script shows how to do it:

    #!/bin/bash
    #		GMT EXAMPLE 04
    #
    # Purpose:	3-D mesh and color plot of Hawaiian topography and geoid
    # GMT progs:	grdcontour, grdgradient, grdimage, grdview, psbasemap, pscoast, pstext
    # Unix progs:	echo, rm
    #
    ps=example_04.ps
    echo '-10  255   0  255' > zero.cpt
    echo '  0  100  10  100' >> zero.cpt
    gmt grdcontour HI_geoid4.nc -R195/210/18/25 -Jm0.45i -p60/30 -C1 -A5+o -Gd4i -K -P \
    	-X1.25i -Y1.25i > $ps
    gmt pscoast -R -J -p -B2 -BNEsw -Gblack -O -K -T209/19.5/1i >> $ps
    gmt grdview HI_topo4.nc -R195/210/18/25/-6/4 -J -Jz0.34i -p -Czero.cpt -O -K \
    	-N-6+glightgray -Qsm -B2 -Bz2+l"Topo (km)" -BneswZ -Y2.2i >> $ps
    echo '3.25 5.75 H@#awaiian@# R@#idge' | gmt pstext -R0/10/0/10 -Jx1i \
    	-F+f60p,ZapfChancery-MediumItalic+jCB -O >> $ps
    rm -f zero.cpt
    #
    ps=example_04c.ps
    gmt grdgradient HI_geoid4.nc -A0 -Gg_intens.nc -Nt0.75 -fg
    gmt grdgradient HI_topo4.nc -A0 -Gt_intens.nc -Nt0.75 -fg
    gmt grdimage HI_geoid4.nc -Ig_intens.nc -R195/210/18/25 -JM6.75i -p60/30 -Cgeoid.cpt -E100 \
    	-K -P -X1.25i -Y1.25i > $ps
    gmt pscoast -R -J -p -B2 -BNEsw -Gblack -O -K >> $ps
    gmt psbasemap -R -J -p -O -K -T209/19.5/1i --COLOR_BACKGROUND=red --FONT=red \
    	--MAP_TICK_PEN_PRIMARY=thinner,red >> $ps
    gmt psscale -R -J -p240/30 -D3.375i/-0.5i/5i/0.3ih -Cgeoid.cpt -I -O -K -Bx2+l"Geoid (m)" >> $ps
    gmt grdview HI_topo4.nc -It_intens.nc -R195/210/18/25/-6/4 -J -JZ3.4i -p60/30 -Ctopo.cpt \
    	-O -K -N-6+glightgray -Qc100 -B2 -Bz2+l"Topo (km)" -BneswZ -Y2.2i >> $ps
    echo '3.25 5.75 H@#awaiian@# R@#idge' | gmt pstext -R0/10/0/10 -Jx1i \
    	-F+f60p,ZapfChancery-MediumItalic+jCB -O >> $ps
    rm -f *_intens.nc

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

3-D perspective mesh plot (left) and colored version (right).

The second part of the script shows how to make the color version of this figure that was printed in our first article in EOS Trans. AGU (8 October 1991). Using grdview one can choose to either plot a mesh surface (left) or a color-coded surface (right). We have also added artificial illumination from a light-source due north, which is simulated by computing the gradient of the surface grid in that direction though the grdgradient program. We choose to use the -Qc 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). Note that the size of the resulting output file is directly dependent on the square of the dpi chosen for the scanline conversion and how well the resulting image compresses. A higher value for dpi in -Qc would have resulted in a much larger output file. The CPT files were taken from Section [sec:example02].

[1] | These data are available on CD-ROM from NGDC (www.ngdc.noaa.gov).

### Navigation

- index
- next
- previous
- Project Home »
- GMT 5.1.1 documentation »
- The GMT historical collection »
- Search: