Re: Problem with plotting two 1D arrays on same plot

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 26 2010 - 15:31:59 MDT

See below

On 04/26/2010 03:25 PM, Ibo Ze wrote:
> Hi,
>
> I want to plot 2 separate 1D arrays (like xy_plot) on a same. But
> subscript mismatch error appear each time. Please help with this.
>
> Thanks,
> Ibo
>
> Following is what i use:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
> f1 = addfile("6104_pk_june_avg.nc <http://6104_pk_june_avg.nc/>","r")
> f2 = addfile("6104_sec_june_avg.nc <http://6104_sec_june_avg.nc/>","r")
> a1 = f1->a
> a2 = f2->a
> dim = dimsizes(a1)
> dim = dimsizes(a2)

dima1 = dimsizes(a1)
dima2 = dimsizes(a2)

dimmx = max( (/dima1, dima2/) )

> time = ispan(1961,2004,1)
> data = new((/2,dim/),float)

data = new( (/2,dimmx/), typeof(a1) )

> data(0,:) = f1(0,:) ; *** not correct ***
> data(1,:) = f2(0,:)

data(0,:dima1-1) = a1
data(1,:dima2-1) = a2

> wks = gsn_open_wks ("x11","aa") ; open ps file
> res = True ; plot mods desired
> res@tiMainString = "June Climatology 1961-2004"
> res@xyLineThicknesses = (/1.0,2.0/)
> res@xyLineColors = (/"red","blue"/)
> res@trYMinF = 0.0
> res@trYMaxF = 10.0
> res@trXMinF = 1960
> res@trXMaxF = 2004
> res@tiXAxisString = "time"
> res@tiYAxisString = "Precipitation (mm/day)"
> plot = gsn_csm_xy(wks,time,data,res)
> end
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 26 15:32:04 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 29 2010 - 08:05:27 MDT