<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Michael,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Putting time values on the X axis in a nicely formatted way requires setting three &quot;tmXB&quot; resources:</div>

<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">  res@tmXBMode = &quot;Explicit&quot;</div><div class="gmail_default" style="font-size:small">  res@tmXBValues = ...</div>

<div class="gmail_default" style="font-size:small">  res@tmXBLabels = ...</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">

The &quot;tmXBValues&quot; needs to be an array of values where you want tickmark labels, and the &quot;tmXBLabels&quot; needs to be an array of the same size containing the labels you want.</div><div class="gmail_default" style="font-size:small">

<br></div><div class="gmail_default" style="font-size:small">The array of values have to correspond to the time values representing your X axis, and not index values. Time values can come in many different formats, and that&#39;s why it was suggested you use &quot;cd_calendar&quot; to convert them to a format that&#39;s easy to process.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You may be able to get by without having to use &quot;cd_calendar&quot;, and instead you can use &quot;time_axis_labels&quot;, which will set those three resources for you.  Please see:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style><a href="http://www.ncl.ucar.edu/Applications/time_labels.shtml">http://www.ncl.ucar.edu/Applications/time_labels.shtml</a><br>
</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The first example shows how to set the tickmark labels by setting those three resources, and the second example shows how to do it using time_axis_labels.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you have further questions about this, it would help if you provided a &quot;printVarSummary&quot; of your time array, and a description of what kind of labels you want on the X axis.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 3:16 AM, Hemming, Michael <span dir="ltr">&lt;<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hello,<br>
<br>
I am creating panel plots using gsn_csm_contour. The data I use has been chosen from a 4d matrix prior to plotting. The metadata is correct for longitude but not for the time axis. I would like to show the time in years, 1-100.
<br>
<br>
time metadata:<br>
<br>
tho = hours, 365_day<br>
potT = days, preleptic_gregorian<br>
<br>
<br>
Here is my code:<br>
<br>
<br>
<span style="background-color:rgb(255,255,153)">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>
<br>
begin<br>
<br>
;##########################################################################<br>
;##########################################################################<br>
;-------------------------Temperature Profile------------------------------<br>
;--------------------------------------------------------------------------<br>
;##########################################################################<br>
;##########################################################################<br>
<br>
;----------Load in data<br>
<br>
;MPIOM<br>
<br>
data12              = addfile (&quot;<a href="http://sector.nc" target="_blank">sector.nc</a>&quot;, &quot;r&quot;)<br>
tho              = data12-&gt;tho<br>
<br>
<br>
variables          = getfilevarnames(data12)<br>
<br>
print(&quot;                                &quot;)<br>
print(&quot; MPIOM temperature data Information:&quot;)<br>
print(&quot;                                &quot;)<br>
print(variables)<br>
printVarSummary(tho)<br>
<br>
;ICON<br>
<br>
noshupw             = addfile (&quot;<a href="http://con.nc" target="_blank">con.nc</a>&quot;, &quot;r&quot;)<br>
potT             = noshupw-&gt;t_acc<br>
potT&amp;lon             = potT&amp;lon-360     ; Fix the longitudes to be &lt; 360<br>
<br>
<br>
;variables          = getfilevarnames(noshupw)<br>
print(&quot;                                &quot;)<br>
print(&quot;ICON temperature data information:&quot;)<br>
print(&quot;                                &quot;)<br>
print(variables)<br>
printVarSummary(potT)<br>
<br>
<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
<br>
;--------------Hovmuller T comparison plots<br>
<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
<br>
;<a href="http://www.ncl.ucar.edu/Applications/Scripts/lat_time_3.ncl" target="_blank">http://www.ncl.ucar.edu/Applications/Scripts/lat_time_3.ncl</a><br>
<br>
;*********************************************<br>
; manipulate data for plotting<br>
;*********************************************<br>
<br>
dm      = rm_single_dims(tho({depth|7},{lon|-30:-30},lat|:,time|:))    <br>
di    = rm_single_dims(potT({depth|7},{lon|-30:-30},lat|:,time|:))   <br>
<br>
dm30S   = rm_single_dims(tho({depth|7},lon|:,{lat|-30:-30},time|:))    <br>
di30S    = rm_single_dims(potT({depth|7},lon|:,{lat|-30:-30},time|:))   <br>
<br>
dmeq   = rm_single_dims(tho({depth|7},lon|:,{lat|0:0},time|:))    <br>
dieq    = rm_single_dims(potT({depth|7},lon|:,{lat|0:0},time|:))   <br>
<br>
dm30N   = rm_single_dims(tho({depth|7},lon|:,{lat|30:30},time|:))    <br>
di30N    = rm_single_dims(potT({depth|7},lon|:,{lat|30:30},time|:))   <br>
<br>
<br>
printVarSummary(dm)<br>
printVarSummary(di)<br>
printVarSummary(dm30S)<br>
printVarSummary(di30S)<br>
<br>
;------Plotting<br>
<br>
wks = gsn_open_wks(&quot;x11&quot;, &quot;T)<br>
<br>
res                          =    True<br>
res@cnFillOn                        =    True<br>
<br>
plot                            =    new(2,graphic)<br>
<br>
res@gsnDraw                      = False                          ; don&#39;t draw<br>
res@gsnFrame                         = False                          ; don&#39;t advance frame<br>
<br>
resP                              = True                           ; modify the panel plot<br>
resP@gsnMaximize                        = True  <br>
res@tiMainFontHeightF                         = 0.02<br>
resP@txFontHeightF                            = 0.015<br>
resP@txString                     = &quot;Temperature at the surface with time at a longitude of 30W&quot;<br>
<br>
res@tiMainString                  =    &quot;M&quot;  <br>
plot(0) = gsn_csm_contour(wks,dm,res)<br>
<br>
res@tiMainString                  =    &quot;I&quot;     <br>
plot(1) = gsn_csm_contour(wks,di,res)<br>
<br>
;gsn_panel(wks,plot,(/1,2/),resP) <br>
<br>
;----------------------------surface plot<br>
<br>
<br>
wks = gsn_open_wks(&quot;x11&quot;, &quot;T_HOVMULLER_MPIOM_ICON_surface_30N&quot;)<br>
<br>
res                          =    True<br>
res@cnFillOn                        =    True<br>
<br>
plot1                            =    new(2,graphic)<br>
<br>
res@gsnDraw                      = False                          ; don&#39;t draw<br>
res@gsnFrame                         = False                          ; don&#39;t advance frame<br>
<br>
<br>
resP@gsnMaximize                        = True  <br>
res@tiMainFontHeightF                         = 0.02<br>
resP@txFontHeightF                            = 0.015<br>
resP@txString                     = &quot;Temperature at the surface with time at a latitude of 30N&quot;<br>
res@lbLabelBarOn        = False <br>
res@cnLevelSelectionMode =  &quot;ManualLevels&quot;   <br>
res@cnMinLevelValF       = 3.<br>
res@cnMaxLevelValF       =  7.<br>
res@cnLevelSpacingF      =   0.2 <br>
res@cnSpanFillPalette     =   True<br>
resP@gsnPanelLabelBar    = True  <br>
<br>
res@tiMainString                  =    &quot;M  <br>
plot1(0) = gsn_csm_contour(wks,dm30N,res)<br>
<br>
res@tiMainString                  =    &quot;I     <br>
plot1(1) = gsn_csm_contour(wks,di30N,res)<br>
<br>
gsn_panel(wks,plot1,(/1,2/),resP) <br>
<br>
<br>
<br>
<br>
<span style="background-color:rgb(255,255,255)">I have been told  I can use cd_calendar but this involves creating a new variable &#39;time&#39; which I would like to avoid. Another option was to change the tick labels but I am not sure how to do this using gsn_csm_contour.
<br>
<br>
thanks,<br>
Michael<br>
</span></span><br>
</div>
</div>

<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>