Re: trouble with time_axis_labels in panel plot

From: Arindam Chakraborty <arch13_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 16 2014 - 05:44:44 MDT

Daniel,
 I'd guess some problem related to time variable. Please assign the time
variable (2d) to a 1d (along with its units) inside the loop (for each
year) and then call time_axis_labels(). Please see this code below which
gives correct tick marks for all years.

wks = gsn_open_wks("x11","test")

th=ispan(0,365,1)*1d0

 res = True

 res@xyMarkLineMode = "Lines"

 res@gsnDraw=False

 res@gsnFrame=False

 res@trYMinF=0

 res@trYMaxF=365

 plt = new(9,graphic)

 rest=True

 rest@ttmAxis="YL"

 rest@ttmFormat="%d%c%y"


 do k=0,8

   rest@ttmValues=(/(/k+1979,1,1,0,0,0/) \

                 ,(/k+1979,3,1,0,0,0/) \

                 ,(/k+1979,5,1,0,0,0/) \

                 ,(/k+1979,7,1,0,0,0/) \

                 ,(/k+1979,9,1,0,0,0/) \

                 ,(/k+1979,11,1,0,0,0/) \

               /)

  tunits="days since "+(k+1979)+"-01-01 12:00:00"

  time=cd_inv_calendar(k+1979,1,1,0,0,0,tunits,0) + ispan(0,364,1)

  time@units=tunits

  time_axis_labels(time,res,rest)

  plt(k)=gsn_csm_xy(wks,sin(th*3.14/180+k*5.0),th,res)

 end do


 resp=True

 gsn_panel(wks,plt,(/3,3/),resp)






--
*Dr Arindam Chakraborty*
CAOS, IISc, Bangalore-12


On Tue, Jul 15, 2014 at 10:25 PM, Daniel Barandiaran <dbarandiaran@gmail.co=
m
> wrote:

> ah, I see now. In Arindan's email it was written with a negative sign on
> the third argument, which returns an error. Nice to know though, that wi=
ll
> certainly come in handy.
>
>
> On Tue, Jul 15, 2014 at 10:48 AM, Karin Meier-Fleischer <
> meier-fleischer@dkrz.de> wrote:
>
>> Hi,
>>
>> short info about looping backwards. This can be done with
>>
>> do i=nyr-1,0,1
>> ...
>> end do
>>
>> Bye,
>> Karin
>>
>>
>> Am 15.07.14 17:34, schrieb Daniel Barandiaran:
>>
>> This is an interesting result. Your prediction of the only first plot
>> (last year) having tickmarks came true, but the date seems to be fine. =
It
>> turns out, btw, that loops can't be done with negative stride, but I jus=
t
>> turned the plot line to
>>
>> plot(nyr-1-t) = gsn_csm_hov(wks,apcp(t,:239,:),res3)
>>
>> as for the date, i put in the following test:
>>
>> date = cd_calendar(time,0)
>> print(date(:,::8,1)+"-"+date(:,::8,2)+"-"+date(:,::8,0)+"
>> "+date(:,4::8,3)+"00hrs")
>>
>> and the output was:
>>
>> (0,0) 6-1-1979 1200hrs
>> (0,1) 6-2-1979 1200hrs
>> (0,2) 6-3-1979 1200hrs
>> (0,3) 6-4-1979 1200hrs
>> (0,4) 6-5-1979 1200hrs
>> (0,5) 6-6-1979 1200hrs
>> (0,6) 6-7-1979 1200hrs
>> (0,7) 6-8-1979 1200hrs
>> (0,8) 6-9-1979 1200hrs
>> (0,9) 6-10-1979 1200hrs
>> ...
>> ...
>> ...
>> (34,83) 8-23-2013 1200hrs
>> (34,84) 8-24-2013 1200hrs
>> (34,85) 8-25-2013 1200hrs
>> (34,86) 8-26-2013 1200hrs
>> (34,87) 8-27-2013 1200hrs
>> (34,88) 8-28-2013 1200hrs
>> (34,89) 8-29-2013 1200hrs
>> (34,90) 8-30-2013 1200hrs
>> (34,91) 8-31-2013 1200hrs
>>
>>
>> as it should have been if the time variable was correctly attributed.
>> I'm still stumped...
>>
>>
>>
>> On Tue, Jul 15, 2014 at 8:15 AM, Arindam Chakraborty <arch13@gmail.com>
>> wrote:
>>
>>> Hi Daniel,
>>> I cannot find a problem apparently in your code. Is your 2d time
>>> variable values are correct for all years? time_axis_label needs explic=
it
>>> values of years. Possibly, a quick check to find out whether it is rela=
ted
>>> to time variable values or inside time_axis_label routnie, you can plot=
 the
>>> last year in the first panel. For example:
>>>
>>> do t=nyr-1,0,-1
>>> ...
>>> end do
>>>
>>> If time labels appear on the last plot (1st year), we need to
>>> investigate further. If it is on the 1st plot (last year), it is possib=
ly
>>> related to values in the time variable.
>>>
>>> regards,
>>> --
>>> *Dr Arindam Chakraborty*
>>> CAOS, IISc, Bangalore-12
>>>
>>>
>>> On Mon, Jul 14, 2014 at 8:49 PM, Daniel Barandiaran <
>>> dbarandiaran@gmail.com> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I am making a large panel plot of Hovmueller plots, and am trying to
>>>> use time_axis_labels to make the time axis tickmarks readable. It wor=
ks,
>>>> but only for the last plot in the panel, all the other plots have no
>>>> tickmarks on the time axis. Any thoughts?
>>>>
>>>> relevant code snippet:
>>>>
>>>> plot = new(35,graphic)
>>>>
>>>> res3 = res
>>>>
>>>> do t = 0,nyr-1
>>>>
>>>> time_axis_labels(time(t,:239),res3,restick)
>>>> res3@gsnCenterString = minyr + t
>>>> plot(t) = gsn_csm_hov(wks,apcp(t,:239,:),res3)
>>>>
>>>> end do
>>>>
>>>> gsn_panel(wks,plot,(/5,7/),resp)
>>>>
>>>> i am also attaching a screenshot of the resulting graphic
>>>>
>>>>
>>>> --
>>>> Danny Barandiaran
>>>> Department of Plants, Soils, and Climate
>>>> Utah State University
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> Danny Barandiaran
>> Department of Plants, Soils, and Climate
>> Utah State University
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.e=
du/mailman/listinfo/ncl-talk
>>
>>
>> --
>> Dipl. Geophys. Karin Meier-Fleischer
>> Application Support, Visualization
>>
>> Deutsches Klimarechenzentrum GmbH E-Mail: meier-fleischer@dkrz.de
>> Bundesstrasse 45a Internet: http://www.dkrz.de/
>> 20146 Hamburg Phone: +49 (0)40 460094 126
>> Germany Fax: +49 (0)40 460094 270
>>
>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>> Sitz der Gesellschaft: Hamburg
>> Amtsgericht Hamburg HRB 39784
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
>
> --
> Danny Barandiaran
> Department of Plants, Soils, and Climate
> Utah State University
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Wed Jul 16 11:45:11 2014

This archive was generated by hypermail 2.1.8 : Fri Aug 01 2014 - 15:10:55 MDT