Re: fatal:XyPlotChanges: error setting overlay object view

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 23 2010 - 08:23:04 MST

I'm not sure if this will work, but instead of setting trXMinF and
trXMaxF explicitly,
try to index your time array for whichever values you want to
actually plot.

For example, if you wanted to start at time "19900101" and end at
"20001231", then
you would do something like this:

   yrs = floattoint(utc(:,0))
   ibeg = where(yrs.eq.1990.and.mons.eq.1.and.days.eq.1)
   iend = where(yrs.eq.2000.and.mons.eq.12.and.days.eq.31)

Then:

   plotA = gsn_csm_xy(wks, time(ibeg:iend), zRegion(ibeg:iend), res)
   . . .
   plotB = gsn_csm_xy(wks, time(ibeg_iend), z1Region(ibeg:iend), res)

The other possibility is to use ut_calendar with an option of -2 to
convert your time to YYYYMMDD, and then plot against these new values
instead of your original time values.

For example:

   new_time = ut_calendar(time, -2)
   . . .
   tm_major_values = new_time(day_1)

Change these to the appropriate YYYYMMDD format:

> res@trXMinF = 17552088 ; set minimum X-axis value
> res@trXMaxF = 17555040 ; set maximum X-axis value

and then:

   plotA = gsn_csm_xy(wks, new_time, zRegion, res)
   . . .
   plotB = gsn_csm_xy(wks, new_time, z1Region, res)

Without knowing what your original time values look like, I'm not
sure what's the best method.

--Mary

On Feb 22, 2010, at 8:02 PM, Kim wrote:

> Dear Mary,
> Please have a look on my code is given below. If I don't set
> trXMinF and trXMaxF it is working but the figure is not correct the
> lines start away from the y-axis. Please your help in this regard
> will be appreciable.
> thanks again,
> kim
> *******************
> --------------------------------------
> --------------------------------------
> f = addfile("shtfl.sfc.gauss.2003.nc","r")
> f1 = addfile("shtfl.sfc.gauss.2002.nc","r")
> z = short2flt(f->shtfl(120:243,:,:))
> z1= short2flt(f1->shtfl(120:243,:,:))
> printVarSummary(z)
> printVarSummary(z1)
> time = z&time
> time = z1&time
> utc = ut_calendar(time,0) ; yr, mo, dy, hr, mn, sc
> mons = floattoint(utc(:, 1)) ; Values from 1 to 12
> days = floattoint(utc(:, 2)) ; Values from 1 to 31
> day_1 = ind(days.eq.1)
> mon_1 = mons(day_1)
> smonths = (/"","J", "F", "M", "A", "MAY", "JUN",\
> "JUL", "AUG", "SEP", "OCT", "N", "D"/)
> tm_major_values = time(day_1)
> tm_major_labels = smonths(mon_1)
>
> zRegion = wgt_areaave_Wrap(z(:,{15:40},{50:100}),1.0,1.0,0)
> z1Region = wgt_areaave_Wrap(z1(:,{15:40},{50:100}),1.0,1.0,0)
> ; printVarSummary(z1Region)
> ; printMinMax(z1Region, True)
> ;**********************************
> wks = gsn_open_wks ("x11","sh")
> res = True
> res@gsnDraw = False
> res@gsnFrame = False
> res@tmLabelAutoStride = True
> res@xyLineColors =(/"red"/)
> res@xyLineThicknesses = 2.0
> res@tiMainString = "”
> res@tmXBMode = "Explicit" ; Define own tick mark labels.
> res@tmXBValues = tm_major_values
> res@tmXBLabels = tm_major_labels
> res@tmXTOn = False ; Turn off tickmarks and labels
> res@tmYROn = False
> res@trXMinF = 17552088 ; set minimum X-axis value
> res@trXMaxF = 17555040 ; set maximum X-axis value
> res@tiYAxisString = "SHFL(W/m^2)"
> res@vpHeightF= 0.4
> res@vpWidthF = 0.8
> plotA = gsn_csm_xy(wks, time,zRegion,res)
> ;**************************************
> res@xyLineColors = (/"blue"/)
> res@trXMinF = 17543328 ; set minimum X-axis value
> res@trXMaxF = 17546280 ; set maximum X-axis value
> plotB = gsn_csm_xy(wks, time,z1Region,res)
> overlay(plotA, plotB)
> draw(plotA)
> frame(wks)
> end
>
>
> --- On Mon, 2/22/10, Mary Haley <haley@ucar.edu> wrote:
>
> From: Mary Haley <haley@ucar.edu>
> Subject: Re: fatal:XyPlotChanges: error setting overlay
> object view
> To: "Kim" <r4rid@yahoo.com>
> Cc: ncl-talk@ucar.edu
> Date: Monday, February 22, 2010, 5:55 AM
>
> Dear Kim,
>
> How are you doing the overlay, and when are you setting trXMinF and
> trXMaxF? It would help if I could see a script.
>
> --Mary
>
> On Feb 21, 2010, at 9:57 PM, Kim wrote:
>
>> Dear NCL users
>> I’m trying to xy-plotA & plotB. Individually and also when I
>> overlay (plotA, plotB) without trXMinF and trXMax resources it is
>> working properly. When I set trXMinF and trXMax during their
>> overlaying it does not work. If I not set these recourses then the
>> lines are not starting at the initial point. Is there any resource
>> or function available in NCL.
>> Thanks
>> kim
>> **************
>> fatal:["MultiText.c":940]:[errno=12]
>> fatal:TickMarkSetValues: Could not set MultiText item values for
>> bottom tick mark labels, cannot continue
>> fatal:TickMarkSetValues: A fatal error was detected while
>> computing tick marks labels,cannot continue
>> fatal:PlotManagerSetValues: Error setting TickMark values
>> fatal:XyPlotChanges: error setting overlay object view
>> fatal:["MultiText.c":940]:[errno=12]
>> fatal:TickMarkSetValues: Could not set MultiText item values for
>> bottom tick mark labels, cannot continue
>> fatal:TickMarkSetValues: A fatal error was detected while
>> computing tick marks labels,cannot continue
>> fatal:XyPlotChanges: error setting overlay object view
>> fatal:["MultiText.c":940]:[errno=12]
>> fatal:TickMarkSetValues: Could not set MultiText item values for
>> bottom tick mark labels, cannot continue
>> fatal:TickMarkSetValues: A fatal error was detected while
>> computing tick marks labels,cannot continue
>> fatal:XyPlotChanges: error setting overlay object view
>> fatal:["MultiText.c":940]:[errno=12]
>> fatal:TickMarkSetValues: Could not set MultiText item values for
>> bottom tick mark labels, cannot continue
>> fatal:TickMarkSetValues: A fatal error was detected while
>> computing tick marks labels,cannot continue
>> fatal:PlotManagerSetValues: Error setting TickMark values
>> fatal:XyPlotChanges: error setting overlay object view
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 23 08:23:13 2010

This archive was generated by hypermail 2.1.8 : Tue Feb 23 2010 - 08:26:41 MST