Re: XY plotting question

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 23 Jun 2006 15:15:05 -0600

Hi Kyle,

I think I got what you want by explicitly setting the tickmarks/tickmark
labels and by using your time_str array as the x-axis input array into
the plot call. Try this:

res2 = True ; Shows the 'correct' format
res2_at_gsnDraw = False ; for time, but does not show
res2_at_gsnFrame = False ; all of the tickmarks and all
res2_at_tmYROn = False ; of the times. NCL won't show
res2_at_tmXTOn = False
res2_at_tmXBMode = "Explicit" ; Taking the XBValues off extends
res2_at_tmXBValues = ispan(0,24,2)
res2_at_tmXBLabels = ispan(0,24,2)
res2_at_trXMinF = 0.
res2_at_trXMaxF = 24.
res2_at_xyLineColor = "red"
plot(2) = gsn_csm_xy(wks,stringtofloat(time_str),wdir,res2)

The key here was passing time_str thru stringtofloat so I could use that
array as the x-coordinates of the wdir array. Then, since time_str ran
from 0->~23, I set up my own tickmarks using tmXBLabels and tmXBValues
to go from 0->24 by 2..

Let me know if this wasn't what you wanted...
Adam

Kyle Wilcox wrote:
> I have been working on making a simple XY plot of a variable vs. time
> for a few 'moments' now. I have come to a brick wall, and have come up
> with three ~possible~ ways of doing it correctly.
>
> I need to relate the Y-axis to a time variable, but I read the variable
> in as a UNIX timestamps. I can correctly convert it to a human friendly
> date, but I can not seem to find a way to show them as the X-axis
> without using tmXBMode = "Explicit". Doing 'Explicit' does its own tick
> placement, and thus makes the graph useless to me. A link below is to a
> PostScript file with some examples. The graphs on the right (plots 1
> and 3) have the correct tick placement, but wrong date format, and the
> graph on the bottom left (plot 2) has the correct date format, but wrong
> tick placement. I also link below to the NCL file that made the graphs
> for anyone who would need to look at it.
>
> PS file: http://208.255.155.35/AnnBuoy/xy.ps
> NCL script: http://208.255.155.35/AnnBuoy/xyplots.ncl
>
> The netCDF in the NCL script can be found on OpenDap server here:
> http://208.255.155.35/cgi-bin/nph-dods/AnnBuoy/2006/2006-05/
> and downloadable file here:
> http://208.255.155.35/AnnBuoy/2006/2006-05/ahb_2006-05-27.nc
>
> Thanks in advance for all your help.
>
> Kyle Wilcox
> kyle.wilcox_at_noaa.gov
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 23 2006 - 15:15:05 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 26 2006 - 07:41:21 MDT