<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2002-2-1 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>7.4 A 3-D perspective mesh plot</TITLE> <META NAME="description" CONTENT="7.4 A 3-D perspective mesh plot"> <META NAME="keywords" CONTENT="GMT_Docs"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="GMT_Docs.css"> <LINK REL="next" HREF="node126.html"> <LINK REL="previous" HREF="node124.html"> <LINK REL="up" HREF="node121.html"> <LINK REL="next" HREF="node126.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html4406" HREF="node126.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4400" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4394" HREF="node124.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4402" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4404" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4407" HREF="node126.html">7.5 A 3-D illuminated</A> <B> Up:</B> <A NAME="tex2html4401" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4395" HREF="node124.html">7.3 Spectral estimation and</A> <B> <A NAME="tex2html4403" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4405" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION001540000000000000000"></A> <A NAME="24336"></A> <BR> 7.4 A 3-D perspective mesh plot </H1> <P> This example will illustrate how to make a fairly complicated composite figure. We need a subset of the ETOPO5 bathymetry<A NAME="tex2html1353" HREF="footnode.html#foot24337"><SUP>7.1</SUP></A>and Geosat geoid data sets which we will extract from the local data bases using <A NAME="tex2html1355" HREF="../man/grdraster.html"><I><B>grdraster</B></I></A><A NAME="24958"></A>. 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: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 04 # # Purpose: 3-D mesh plot of Hawaiian topography and geoid # GMT progs: grdcontour, grdview, pscoast, pstext # Unix progs: echo, rm # ps=example_04.ps echo '-10 255 0 255' > zero.cpt echo ' 0 100 10 100' >> zero.cpt grdcontour HI_geoid4.nc -Jm0.45i -E60/30 -R195/210/18/25 -C1 -A5+o -Gd4i -K -P -X1.5i -Y1.5i \ -U/-1.25i/-1.25i/"Example 4 in Cookbook" > $ps pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K -T209/19.5/1i >> $ps grdview HI_topo4.nc -J -Jz0.34i -Czero.cpt -E60/30 -R195/210/18/25/-6/4 -N-6/lightgray -Qsm -O -K \ -B2/2/2:"Topo (km)":neswZ -Y2.2i >> $ps echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> $ps rm -f zero.cpt .gmt* </PRE> <BR CLEAR="ALL"> <HR> <P> The purpose of the color palette file <U>zero.cpt</U> is to have the positive topography mesh painted light gray (the remainder is white). The left side of Figure <A HREF="#fig:GMT_example_04">7.4</A> shows the complete illustration. <P> <DIV ALIGN="CENTER"><A NAME="fig:GMT_example_04"></A><A NAME="24345"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.4:</STRONG> 3-D perspective mesh plot (left) and colored version (right).</CAPTION> <TR><TD><IMG WIDTH="335" HEIGHT="418" ALIGN="BOTTOM" BORDER="0" SRC="img158.png" ALT="\includegraphics[scale=0.42]{scripts/example_04}"> <IMG WIDTH="335" HEIGHT="418" ALIGN="BOTTOM" BORDER="0" SRC="img159.png" ALT="\includegraphics[scale=0.42]{scripts/example_04c}"></TD></TR> </TABLE> </DIV> <P> A color version of this figure was used in our first article in <I>EOS Trans. AGU</I> (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 <B>-Qi</B> option in <A NAME="tex2html1356" HREF="../man/grdview.html"><I><B>grdview</B></I></A><A NAME="24966"></A> 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 <A NAME="tex2html1357" HREF="../man/grdgradient.html"><I><B>grdgradient</B></I></A><A NAME="24971"></A> to provide the intensity files. The following script creates the color <I>PostScript</I> 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 <B>-Qi</B> would have resulted in a much larger output file. The cpt files were taken from Section <A HREF="node123.html#sec:example_02">7.2</A>. <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 04c # # 3-D perspective color plot of Hawaiian topography and geoid # GMT progs: grdcontour, grdview, pscoast, pstext # Unix progs: echo, rm # ps=example_04c.ps grdgradient HI_geoid4.nc -A0 -Gg_intens.nc -Nt0.75 -M grdgradient HI_topo4.nc -A0 -Gt_intens.nc -Nt0.75 -M grdview HI_geoid4.nc -Ig_intens.nc -JM6.75i -E60/30 -R195/210/18/25 -Cgeoid.cpt -Qi100 -K \ -X1.5i -Y1.25i -P -U/-1.25i/-1i/"Example 04c in Cookbook" > $ps pscoast -J -E60/30 -R -B2/2NEsw -Gblack -O -K >> $ps psbasemap -R -J -E60/30 -O -K -T209/19.5/1i --COLOR_BACKGROUND=red --TICK_PEN=thinner,red >> $ps grdview HI_topo4.nc -It_intens.nc -J -JZ3.4i -Ctopo.cpt -E60/30 -R195/210/18/25/-6/4 \ -N-6/lightgray -Qi100 -O -K -Y2.2i >> $ps psbasemap -J -JZ3.4i -E60/30 -R -Z-6 -O -K -B2/2/2:"Topo (km)":neZ >> $ps echo '3.25 5.75 60 0.0 33 BC H@#awaiian@# R@#idge' | pstext -R0/10/0/10 -Jx1i -O >> $ps rm -f *_intens.nc .gmt* </PRE> <BR CLEAR="ALL"> <HR> <P> <A NAME="24355"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html4406" HREF="node126.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4400" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4394" HREF="node124.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4402" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4404" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4407" HREF="node126.html">7.5 A 3-D illuminated</A> <B> Up:</B> <A NAME="tex2html4401" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4395" HREF="node124.html">7.3 Spectral estimation and</A> <B> <A NAME="tex2html4403" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4405" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>