Hi Li,
Yes, you can panel plots that were overlaid with "overlay". Example
13 on the panel page shows how to do this.
The one difference is that this example does not contain a function.
Your "sub_draw" function is not returning anything, which might be
the problem. It should return "plot1":
return(plot1)
--Mary
On Mar 29, 2010, at 11:30 AM, lxf wrote:
> Hi,
> I met some problem about how to panel the overlayed figures.
> I mean a contour map (using gsn_csm_contour ) overlayed on a
> shaded one (use gsn_csm_contour_map_polar), and then panel 2 or
> more of these overlayed pic. I checked the http://www.ncl.ucar.edu/
> Applications/panel.shtml and did not find the example I want.
> Any suggestion or help is appreciated.
>
> Here, I give the main program and funtions I wrote as following:
> ;--------------------------------------------
> ; Main Program to draw panel
> ;--------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "./sub_draw.ncl" ; This is a function to draw the overlayed
> pictures
> begin
> outname = "./plot"
> fili = "in.nc"
> f = addfile (fili , "r")
> u = f->u
> h = f->h
>
> ; Ploting
> ;......
> wks = gsn_open_wks("eps",outname)
> cmap = RGBtoCmap("rgb.y-r.txt") ; RCGtoCmap
> in contributed
> gsn_define_colormap(wks,cmap)
> npanels = 2
> plot = new(npanels,graphic)
>
> plot(0) = sub_draw(wks,outname,it,ilev,u(time|it,{lev|500},{lat|
> 0:90},lon|:),h(time|it,{lev|500},{lat|0:90},lon|:))
> plot(1) = sub_draw(wks,outname,it,ilev,u(time|it,{lev|500},{lat|
> 0:90},lon|:),h(time|it,{lev|500},{lat|0:90},lon|:))
>
> resP = True ; modify the
> panel plot
> resP@gsnMaximize = True
> resP@gsnMaximize = True
> resP@gsnFrame = False
> resP@gsnPaperOrientation = "portrait"
> resP@gsnPanelBottom = 0.05
> resP@gsnPanelLabelBar = True
> resP@lbLabelFontHeightF = 0.009;0.011
> resP@lbLabelAutoStride = 2
> resP@pmLabelBarWidthF = 0.45 ;0.55 ; default is
> shorter
> resP@pmLabelBarHeightF = 0.05 ;0.06 ; default is
> taller
>
> gsn_panel(wks,plot,(/2,1/),resP)
> frame(wks)
>
> end
> ;--------------------------------------------
> ; Functions called by Main Program
> ;--------------------------------------------
> undef("sub_draw")
> function sub_draw(wks,outname,it,ilev,u,h)
> local it,ilev,outname,u,h,wks,res1,res2,plot1,plot2
> begin
>
> ; create the First plot
> ;...
> res1 = True
> ;res1@gsnPolar = "NH" ; select northern hemisphere
> res1@gsnPolarNH = True
> res1@gsnFrame = False ; don't advance frame
> res1@gsnDraw = False
> res1@gsnAddCyclic = True
>
> res1@mpFillOn = False
> res1@mpMinLatF = 20 ; minimum latitude
> res1@mpGridAndLimbOn = True ; turn off grid
> res1@mpGridLineThicknessF =1.5
> res1@gsnTickMarksOn = True ; turn off tickmarks
> res1@cnInfoLabelOn = False
>
> res1@cnFillOn = True ;True ; color fill
> res1@cnLinesOn = False
>
> res1@lbLabelBarOn = False
> res1@lbLabelFontHeightF = 0.02
> res1@lbLabelAutoStride = 2
> res1@pmLabelBarWidthF = 1.0 ; default is shorter
> res1@pmLabelBarHeightF = 0.12 ; default is taller
>
> res1@vpWidthF = 1.1
> res1@gsnPaperOrientation = "portrait"
> res1@gsnMaximize = True
>
> res1@gsnSpreadColors = True
> res1@cnLevelSelectionMode = "ManualLevels" ; set manual
> contour levels
> res1@cnMinLevelValF = -60
> res1@cnMaxLevelValF = 60
> res1@cnLevelSpacingF = 10
>
> plot1= gsn_csm_contour_map_polar(wks,h,res1)
>
> ; create the Second Plot
> ;...
> res2 = True ; plot mods desired
> res2@gsnFrame = False ; don't advance frame
> res2@gsnDraw = False
> res2@gsnAddCyclic = True
> res2@cnInfoLabelOn = False
> res2@cnFillOn = False ;True ; color fill
> res2@gsnContourLineThicknessesScale = 2
> res2@gsnContourZeroLineThicknessF = 2 ; doubles
> thickness of zero contour
> res2@gsnContourNegLineDashPattern = 1
>
> res2@vpWidthF = 1.1
> res2@gsnPaperOrientation = "portrait"
> res2@gsnMaximize = True
>
> res2@gsnLeftString = "Phase "+it+" / "+ilev+"hPa
> " ; no left string
> res2@cnLevelSelectionMode = "ManualLevels" ; Manually set the
> cn Levels
> res2@cnMinLevelValF = -2.4 ; set min contour
> level
> res2@cnMaxLevelValF = 2.4 ; set max
> contour level
> res2@cnLevelSpacingF = 0.4
>
> plot2 = gsn_csm_contour(wks,u,res2)
>
> ; overlay the plots
> ;...
> overlay(plot1,plot2)
> ;draw(plot1)
> ;frame(wks)
>
> return()
> end
>
> ;--------------------------------------------
>
>
> Sincerely,
> Li
>
>
> _______________________________________________
> 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 Mon Mar 29 12:39:57 2010
This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT