Re: three maps in one plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 23 2012 - 10:48:04 MDT

The default shape of an XY plot is always a square, unless you set
the vpWidthF and vpHeightF resources. These should be set to
values between 0. and 1., and should represent the aspect
ratio you want. For example, if you want the plots to be
4 times as wide as they are high, you can set:

res@vpWidthF = 0.8
res@vpHeightF =0.2

gsn_panel will retain the aspect ratio, and will resize them to fit
the page if you set pres@gsnMaximize = True, which you are
already doing.

--Mary

On Mar 23, 2012, at 11:29 AM, ousmane ndiaye wrote:

> Hi,
> I'm drawing three maps on a plot but want each map to span the whole width of the page.
> Here is my plot and my script, what should I change
> ousmane
>
> ==
> ; the model file
> in = addfile(files(i),"r");
> pr=in->tp_P11_L1_GLL0_acc(:,:,:,{12.5:17},{342:349}) ; extracting senegal
> xm=dim_avg_n(dim_avg_n(pr,4),3) ;average XY over senegal
>
> ;************************************************
> ; plotting parameters
> ;************************************************
> res=True
> res@gsnFrame = False ; Do not advance page frame
> res@gsnDraw = False ;so that individual plots are not drawn
> res@trYMinF = 0 ; Set axes limits.
> res@trYMaxF = 90;
> res@trXMinF = 1
> res@trXMaxF = 184
>
> plot = new(3,graphic) ; create graphics array
> d=new(3,graphic)
>
> ;=== start the three panels plots
> do j=0,2
> xmfcst= (xm(:,:,ix(j))-xm(:,:,ix(j)-1)) ;forecast lead
> xmin = dim_min_n( xmfcst, 0 ) ;min value of all runs
> xmax = dim_max_n( xmfcst, 0 ) ;max value of all runs
> do k=0,183
> xp(k)=x(k)
> xp(2*184-1-k)=x(k)
> yp(k)=xmax(k)
> yp(2*184-1-k)=xmin(k)
> end do
>
> res@tiMainString = tt(j) ; title
> res@tiYAxisString = "Rainfall in mm/day" ; y axis title
> res@tiXAxisString = "Date" ; x axis title
> res@tmXBMode ="Explicit"
> res@tmXBValues = (/1,32,62,93,124,154/) ; bottom tick mark
> res@tmXBLabels = (/"1My","1Jn","1Jl","1Au","1Sp","1Oc"/) ; labels
>
> res@xyMonoDashPattern = True ;By default, lines are dashed make them all solid
> res@xyLineColor = "Black"
> res@xyLineThicknessF = 2 ; 3x as thick
> plt = gsn_csm_y(wks,obs,res) ;plot obs
> res@xyLineColor = "Blue"
> plot(j) = gsn_csm_y(wks,dim_avg_n(xmfcst,0),res) ;plot ens_mean
> overlay(plot(j),plt) ;overlay the two and put them in the first
> ; plot the shading
> gsres = True ; poly res
> gsres@tfPolyDrawOrder = "Predraw" ; draw this first
> gsres@gsFillColor = "SlateBlue" ; color chosen
> d(j) = gsn_add_polygon (wks,plot(j),xp,yp,gsres)
> end do
>
> ;*******************************************
> ; draw panel plot with title
> ;*******************************************
> pres = True ; mod panel plot
> pres@gsnPanelBottom = 0.05 ; add some space at bottom
> pres@txString = model(i)
> pres@gsnMaximize = True ;Maximizing plots in a frame
> gsn_panel(wks,plot,(/3,1/),pres) ; create panel plot
> frame(wks)
> ==
>
> <ECMWF_.png>_______________________________________________
> 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 Fri Mar 23 10:48:20 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 27 2012 - 08:50:24 MDT