<!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>4.4.3.5 Cartesian time axes</TITLE> <META NAME="description" CONTENT="4.4.3.5 Cartesian time axes"> <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="previous" HREF="node46.html"> <LINK REL="up" HREF="node42.html"> <LINK REL="next" HREF="node48.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html3294" HREF="node48.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3288" HREF="node42.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3284" HREF="node46.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3290" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3292" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3295" HREF="node48.html">4.4.4 Header data records:</A> <B> Up:</B> <A NAME="tex2html3289" HREF="node42.html">4.4.3 Map frame and</A> <B> Previous:</B> <A NAME="tex2html3285" HREF="node46.html">4.4.3.4 Cartesian exponential axes</A> <B> <A NAME="tex2html3291" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3293" HREF="node258.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H3><A NAME="SECTION001243500000000000000"> 4.4.3.5 Cartesian time axes</A> </H3> <P> What sets time axis apart from the other kinds of plot axes is the numerous ways in which we may want to tick and annotate the axis. Not only do we have both primary and secondary annotation items but we also have interval annotations versus tickmark annotations, numerous time units, and several ways in which to modify the plot. We will demonstrate this flexibility with a series of examples. While all our examples will only show a single <IMG WIDTH="11" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img4.png" ALT="$x$">-axis, time-axis is supported for all axes. <P> Our first example shows a time period of almost two months in Spring 2000. We want to annotate the month intervals as well as the date at the start of each week: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT -o ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R2000-4-1T/2000-5-25T/0/1 -JX5/0.2 -Bpa7Rf1d -Bsa1OS -P > GMT_-B_time1.ps </PRE> <BR CLEAR="ALL"> <HR> <P> These commands result in Figure <A HREF="#fig:GMT_-B_time1">4.11</A>. Note the leading hyphen in the <B>PLOT_DATE_FORMAT</B> removes leading zeros from calendar items (e.g., 02 becomes 2). <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time1"></A><A NAME="19549"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.11:</STRONG> Cartesian time axis, example 1.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="576" HEIGHT="45" ALIGN="BOTTOM" BORDER="0" SRC="img56.png" ALT="\includegraphics{scripts/GMT_-B_time1}"></DIV></TD></TR> </TABLE> </DIV> <P> The next example shows two different ways to annotate an axis portraying 2 days in July 1969: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT "o dd" PLOT_CLOCK_FORMAT hh:mm ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R1969-7-21T/1969-7-23T/0/1 -JX5/0.2 -Bpa6Hf1h -Bsa1KS -P -K > GMT_-B_time2.ps psbasemap -R -J -Bpa6Hf1h -Bsa1DS -O -Y0.65i >> GMT_-B_time2.ps </PRE> <BR CLEAR="ALL"> <HR> <P> The lower example (Figure <A HREF="#fig:GMT_-B_time2">4.12</A>) chooses to annotate the weekdays (by specifying <B>a</B>1<B>K</B>) while the upper example choses dates (by specifying <B>a</B>1<B>D</B>). Note how the clock format only selects hours and minutes (no seconds) and the date format selects a month name, followed by one space and a two-digit day-of-month number. <P> <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time2"></A><A NAME="19555"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.12:</STRONG> Cartesian time axis, example 2.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="610" HEIGHT="119" ALIGN="BOTTOM" BORDER="0" SRC="img57.png" ALT="\includegraphics{scripts/GMT_-B_time2}"></DIV></TD></TR> </TABLE> </DIV> <P> The third example presents two years, annotating both the years and every 3rd month. <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT o TIME_FORMAT_PRIMARY Character ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R1997T/1999T/0/1 -JX5/0.2 -Bpa3Of1o -Bsa1YS -P > GMT_-B_time3.ps </PRE> <BR CLEAR="ALL"> <HR> <P> Note that while the year annotation is centered on the 1-year interval, the month annotations must be centered on the corresponding month and <I>not</I> the 3-month interval. The <B>PLOT_DATE_FORMAT</B> selects month name only and <B>TIME_FORMAT_PRIMARY</B> selects the 1-character, upper case abbreviation of month names using the current language (selected by <B>TIME_LANGUAGE</B>). <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time3"></A><A NAME="19561"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.13:</STRONG> Cartesian time axis, example 3.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="576" HEIGHT="41" ALIGN="BOTTOM" BORDER="0" SRC="img58.png" ALT="\includegraphics{scripts/GMT_-B_time3}"></DIV></TD></TR> </TABLE> </DIV> <P> The fourth example (Figure <A HREF="#fig:GMT_-B_time4">4.14</A>) only shows a few hours of a day, using relative time by specifying <B>t</B> in the <B>-R</B> option while the <B>TIME_UNIT</B> is <B>d</B> (for days). We select both primary and secondary annotations, ask for a 12-hour clock, and let time go from right to left: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_CLOCK_FORMAT -hham ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R0.2t/0.35t/0/1 -JX-5/0.2 -Bpa15mf5m -Bsa1HS -P > GMT_-B_time4.ps </PRE> <BR CLEAR="ALL"> <HR> <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time4"></A><A NAME="19568"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.14:</STRONG> Cartesian time axis, example 4.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="576" HEIGHT="44" ALIGN="BOTTOM" BORDER="0" SRC="img59.png" ALT="\includegraphics{scripts/GMT_-B_time4}"></DIV></TD></TR> </TABLE> </DIV> <P> The fifth example shows a few weeks of time (Figure <A HREF="#fig:GMT_-B_time5">4.15</A>). The lower axis shows ISO weeks with week numbers and abbreviated names of the weekdays. The upper uses Gregorian weeks (which start at the day chosen by <B>TIME_WEEK_START</B>); they do not have numbers. <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT u TIME_FORMAT_PRIMARY Character TIME_FORMAT_SECONDARY full \ ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R1969-7-21T/1969-8-9T/0/1 -JX5/0.2 -Bpa1K -Bsa1US -P -K > GMT_-B_time5.ps gmtset PLOT_DATE_FORMAT o TIME_WEEK_START Sunday TIME_FORMAT_SECONDARY Chararacter psbasemap -R -J -Bpa3Kf1k -Bsa1rS -O -Y0.65i >> GMT_-B_time5.ps </PRE> <BR CLEAR="ALL"> <HR> <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time5"></A><A NAME="19574"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.15:</STRONG> Cartesian time axis, example 5.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="576" HEIGHT="116" ALIGN="BOTTOM" BORDER="0" SRC="img60.png" ALT="\includegraphics{scripts/GMT_-B_time5}"></DIV></TD></TR> </TABLE> </DIV> <P> Our sixth example shows the first five months of 1996, and we have annotated each month with an abbreviated, upper case name and 2-digit year. Only the primary axes information is specified. <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT "o yy" TIME_FORMAT_PRIMARY Abbreviated psbasemap -R1996T/1996-6T/0/1 -JX5/0.2 -Ba1Of1dS -P > GMT_-B_time6.ps </PRE> <BR CLEAR="ALL"> <HR> <P> <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time6"></A><A NAME="19580"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.16:</STRONG> Cartesian time axis, example 6.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="576" HEIGHT="30" ALIGN="BOTTOM" BORDER="0" SRC="img61.png" ALT="\includegraphics{scripts/GMT_-B_time6}"></DIV></TD></TR> </TABLE> </DIV> <P> Our seventh and final example illustrates annotation of year-days. Unless we specify the formatting with a leading hyphen in <B>PLOT_DATE_FORMAT</B> we get 3-digit integer days. Note that in order to have the two years annotated we need to allow for the annotation of small fractional intervals; normally such truncated interval must be at least half of a full interval. <BR CLEAR="ALL"> <HR> <BR> <PRE>gmtset PLOT_DATE_FORMAT jjj TIME_INTERVAL_FRACTION 0.05 ANNOT_FONT_SIZE_PRIMARY +9p psbasemap -R2000-12-15T/2001-1-15T/0/1 -JX5/0.2 -Bpa5Df1d -Bsa1YS -P > GMT_-B_time7.ps </PRE> <BR CLEAR="ALL"> <HR> <P> <DIV ALIGN="CENTER"><A NAME="fig:GMT_-B_time7"></A><A NAME="19586"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 4.17:</STRONG> Cartesian time axis, example 7.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="579" HEIGHT="40" ALIGN="BOTTOM" BORDER="0" SRC="img62.png" ALT="\includegraphics{scripts/GMT_-B_time7}"></DIV></TD></TR> </TABLE> </DIV> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html3294" HREF="node48.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html3288" HREF="node42.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html3284" HREF="node46.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html3290" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html3292" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html3295" HREF="node48.html">4.4.4 Header data records:</A> <B> Up:</B> <A NAME="tex2html3289" HREF="node42.html">4.4.3 Map frame and</A> <B> Previous:</B> <A NAME="tex2html3285" HREF="node46.html">4.4.3.4 Cartesian exponential axes</A> <B> <A NAME="tex2html3291" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html3293" HREF="node258.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2011-02-27 </ADDRESS> </BODY> </HTML>