Re: panel plot sizes

From: Derrick Snowden <Derrick.Snowden_at_nyahnyahspammersnyahnyah>
Date: Tue, 09 Jan 2007 16:51:57 -0500

Thanks Adam and Mary. After trying your one by one elimination, it
seems like the drawNDCGrid call was constraining my viewport to be
square. It works fine now.

Thanks
Derrick

On Mon, 2007-01-08 at 14:56 -0700, Adam Phillips wrote:
> Hi Derrick,
>
> Something is conflicting with gsnMaximize. Strange font height settings
> and or viewport settings can have this kind of effect on gsnMaximize.
> Looking through your script though nothing jumps out at me.
>
> My advice: If the script doesn't take long to run, comment out the last
> 10 or so resources, and run the script again. Keep commenting out
> resources until you've found the one that is conflicting. Keep your
> panel resource list short, only have gsnMaximize set.
>
> If after finding the offending resource you don't understand why that
> resource would affect gsnMaximize, write us back and we'll be happy to
> take a look at it.
> Adam
>
> Derrick Snowden wrote:
> > Thanks for the effort but no dice. I've tried so many different
> > combinations of this section that I feel like I should have stumbled
> > across the solution by shear chance. What is suspicious to me is that
> >
> > resP = True
> > ;resP_at_gsnPaperWidth = 8.5
> > ;resP_at_gsnPaperHeight = 11
> > ;resP_at_gsnPaperOrientation = "portrait"
> > ;resP_at_gsnMaximize = True
> > ;resP_at_vpHeightF = .8
> > ;resP_at_vpYF = .95
> > gsn_panel(wks,plot,(/2,1/),resP)
> > ;-----------------------------------
> >
> > and
> >
> > resP = True
> > ;resP_at_gsnPaperWidth = 8.5
> > ;resP_at_gsnPaperHeight = 11
> > ;resP_at_gsnPaperOrientation = "portrait"
> > resP_at_gsnMaximize = True
> > ;resP_at_vpHeightF = .8
> > ;resP_at_vpYF = .95
> > gsn_panel(wks,plot,(/2,1/),resP)
> > ;-----------------------------------
> >
> > produce the same output. That is, regardless of any of the other
> > resources, gsnMaximize seems to be ignored. The top 1.7" and the bottom
> > 1.7" are always blank.
> >
> > -Derrick
> >
> > On Mon, 2007-01-08 at 14:29 -0700, Adam Phillips wrote:
> >> Hi Derrick,
> >> ;-----------------------------------
> >> resP = True
> >> resP_at_gsnPaperWidth = 8.5
> >> resP_at_gsnPaperHeight = 11
> >> resP_at_gsnPaperOrientation = "portrait"
> >> ;resP_at_gsnMaximize = True
> >> resP_at_vpHeightF = .8
> >> resP_at_vpYF = .95
> >> gsn_panel(wks,plot,(/2,1/),resP)
> >> ;-----------------------------------
> >>
> >> I think the vpHeightF and vpYF resources are what is messing the plot up
> >> here. Try removing them along with the gsnPaperWidth/gsnPaperWidth
> >> resources (not needed when you set them to 8.5/11)..
> >>
> >> I bet the two vp resources are clashing with gsnMaximize...
> >> Good luck,
> >> Adam
> >>
> >> Derrick Snowden wrote:
> >>> Hello all,
> >>>
> >>> I'm struggling with altering the size of a panel plot. Attached is a
> >>> png version of the plot as it currently is, with NDC coordinates
> >>> overlayed. I'd like the NDC grid to extend the full height of the 8.5"
> >>> by 11" page, but for some reason it only seems to occupy about 2/3 of
> >>> the total height.
> >>>
> >>> Also, notice on the bottom plot that the x label is missing or cropped
> >>> off even though I specify
> >>>
> >>> res_at_tmXBLabelsOn = True ; draw bottom labels
> >>>
> >>> in the script (also attached). I'd be grateful for any insights.
> >>>
> >>> Best,
> >>> Derrick
> >>>
> >>>
> >>>
> >>> ------------------------------------------------------------------------
> >>>
> >>> ; :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> >>> ; Program p_surface_currents_sst:
> >>> ; Two panel plot of drifter currents and ersst on top with the
> >>> ; model currents and sst on the bottom.
> >>> ;
> >>> ; Usage: ncl p_surface_currents_sst.ncl
> >>> ;
> >>> ; :mode=ncl:tabSize=4:indentSize=4:noTabs=false:
> >>> ; :folding=none:collapseFolds=3:wrap=soft:maxLineLen=none:
> >>> ;
> >>> ; Creation date: Fri Dec 15, 2006
> >>> ; Author:
> >>> ; Derrick P. Snowden
> >>> ; Physical Oceanography Division,
> >>> ; Atlantic Oceanographic and Meteorological Laboratory, NOAA
> >>> ;
> >>> ;
> >>> ;************************************
> >>> 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"
> >>>
> >>> ;************************************
> >>> begin ;
> >>> ;************************************
> >>> data_dir = "/dps1/snowden/PhODHelp/Bob/gfdl/data/"
> >>>
> >>> inTObs = addfile(data_dir+"ersst_subset.nc","r")
> >>> inUObs = addfile("/dps2/data/Drifters/Drifter_Annual_Climatology.nc","r")
> >>>
> >>> inTModel = addfile(data_dir+"tosH1atl.nc","r") ;468-1668
> >>> inUModel = addfile(data_dir+"uo_atl_00_mean.nc","r")
> >>> inVModel = addfile(data_dir+"vo_atl_00_mean.nc","r")
> >>>
> >>> v1=inUObs->v(:,:)
> >>> u1=inUObs->u(:,:)
> >>>
> >>> v2=inVModel->vo(0,0,:,:)
> >>> u2=inUModel->uo(0,0,:,:)
> >>> u2!0="lat"
> >>> u2!1="lon"
> >>> lon=u2&lon
> >>> lon(ind(lon>180))=lon(ind(lon>180)) -360
> >>> u2&lon=lon
> >>> v2!0="lat"
> >>> v2!1="lon"
> >>> v2&lon=lon
> >>>
> >>> ; Deal with model two d coordinates
> >>> stride=2
> >>> lat2d = inUModel->geolat(::stride,::stride)
> >>> lon2d = inUModel->geolon(::stride,::stride)
> >>> u2_at_lon2d = lon2d
> >>> u2_at_lat2d = lat2d
> >>> v2_at_lon2d = lon2d
> >>> v2_at_lat2d = lat2d
> >>>
> >>> printVarSummary(u2)
> >>> printVarSummary(v2)
> >>> printVarSummary(lat2d)
> >>> printVarSummary(lon2d)
> >>>
> >>> sst1tmp = inTObs->temperature
> >>> sst1 = dim_avg_Wrap(sst1tmp(latitude|:,longitude|:,time|:))
> >>> sst1_at_long_name="ERSST"
> >>>
> >>> sst2tmp = inTModel->tos(468:1668,:,:)-273.15
> >>> copy_VarCoords(inTModel->tos(468:1668,:,:),sst2tmp)
> >>> sst2 = dim_avg_Wrap(sst2tmp(lat|:,lon|:,time|:))
> >>> sst2_at_units="degC"
> >>> sst2!0="latitude"
> >>> sst2!1="longitude"
> >>> sst2_at_long_name = "Model SST"
> >>>
> >>> month_abbr = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", \
> >>> "Oct","Nov","Dec"/)
> >>> ;***********************************************************
> >>> ; colormap and land color
> >>> ;***********************************************************
> >>> ; wks = gsn_open_wks("x11","figure1") ; choose output type
> >>> wks = gsn_open_wks("ps","surface_currents") ; choose output type
> >>> drawNDCGrid(wks)
> >>> plot = new(2,graphic) ; create a plot array
> >>> colors = (/"white","black","white","royal blue","light sky blue",\
> >>> "powder blue","light sea green","pale green","wheat","brown",\
> >>> "pink"/)
> >>>
> >>> gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; choose colormap
> >>> i = NhlNewColor(wks,.9,.9,.9) ; land color
> >>> ;*************************************************************
> >>> ; contour plot resources
> >>> ;*************************************************************
> >>> res = True
> >>> res_at_gsnFrame = False ; so we can draw time stamp
> >>> res_at_gsnDraw = False ; don't draw
> >>> res_at_cnFillOn = False ; turn on color
> >>> res_at_cnLinesOn = True ; turn on contour lines
> >>> res_at_cnInfoLabelOn = False ; turn off cn info label
> >>> res_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> >>> res_at_cnMinLevelValF = 5.0 ; set min contour level
> >>> res_at_cnMaxLevelValF = 28.0 ; set max contour level
> >>> res_at_cnLevelSpacingF = 2.0 ; set contour spacing
> >>>
> >>> ;*************************************************************
> >>> ; color and label bar resources
> >>> ;*************************************************************
> >>> res_at_gsnAddCyclic = False ; regional data
> >>> ;*************************************************************
> >>> ; adjust vector thining depending on size of grid
> >>> ;*************************************************************
> >>> if( max(u1&latitude) - min(u1&latitude) .ge. 5 .or. \
> >>> max(u1&longitude) - min(u1&longitude) .ge. 5)
> >>> stride = 2
> >>> else
> >>> stride = 1
> >>> end if
> >>>
> >>> ;*************************************************************
> >>> ; vector plot resources
> >>> ;*************************************************************
> >>> res_at_vcRefAnnoPerimOn = True
> >>> res_at_vcGlyphStyle = "CurlyVector" ; curly vector style
> >>> ; = "FillArrow" ; curly vector style
> >>> res_at_vcRefAnnoOrthogonalPosF = -1. ; move ref vector up
> >>> res_at_vcRefAnnoSide = "Left"
> >>> res_at_vcRefAnnoJust = "TopLeft"
> >>> res_at_vcRefMagnitudeF = 0.25 ; mag of ref vector
> >>> res_at_vcRefLengthF = 0.05 ; length of ref vector
> >>> res_at_vcLineArrowHeadMaxSizeF = 0.013 ; arrow head size
> >>> res_at_vcLineArrowThicknessF = 1.5 ; arrow thickness
> >>> res_at_vcLineArrowColor = "Black" ; arrow thickness
> >>> res_at_vcRefAnnoString2 = "m/s" ; unit string
> >>> res_at_vcRefAnnoString2On = True ; turn on second string
> >>> res_at_vcRefAnnoPerimOn = True
> >>> res_at_vcRefAnnoFont = 21
> >>> res_at_gsnScalarContour = True ; want vectors over contours
> >>>
> >>> ;**************************************************
> >>> ; map resources
> >>> ;**************************************************
> >>>
> >>> res_at_mpLimitMode = "LatLon" ; Change the area of the map
> >>> res_at_mpOutlineOn = False ; turn off outline
> >>> res_at_mpMaxLatF = 75 ; zoom in on region
> >>> res_at_mpMinLatF = 0
> >>> res_at_mpMinLonF = -80
> >>> res_at_mpMaxLonF = 0
> >>> res_at_mpGridMaskMode = "MaskNotOcean"
> >>> res_at_mpGridLineDashPattern = 2
> >>>
> >>> ;**************************************************
> >>> ; label bar resources
> >>> ;**************************************************
> >>> res_at_pmLabelBarDisplayMode = "Never" ;"Always"
> >>>
> >>> ;**************************************************
> >>> ; adjust lat/lon labeling depending on size of grid
> >>> ;**************************************************
> >>> if( max(u1&latitude) - min(u1&latitude) .le. 5)
> >>> res_at_gsnMajorLatSpacing = 1
> >>> else
> >>> res_at_gsnMajorLatSpacing = 10
> >>> end if
> >>>
> >>> if( max(u1&longitude) - min(u1&longitude) .le. 7)
> >>> res_at_gsnMajorLonSpacing = 1
> >>> else
> >>> res_at_gsnMajorLonSpacing = 10
> >>> end if
> >>> ;**************************************************
> >>> ; strings and font heights
> >>> ;**************************************************
> >>> font_height = 0.015
> >>> res_at_tmYLLabelFontHeightF = font_height
> >>> res_at_tmXBLabelFontHeightF = font_height
> >>> res_at_gsnStringFont = 21
> >>> ;res_at_tiMainString = "Surface Currents and Temperature"
> >>> ;res_at_gsnPaperWidth = 8.5
> >>> ;res_at_gsnPaperHeight = 11
> >>> ;res_at_gsnPaperOrientation = "portrait"
> >>> ;res_at_gsnMaximize = True ; must include w/ Paper Orientation
> >>>
> >>> ;**************************************************
> >>> ; assign required attributes
> >>> ;**************************************************
> >>> u1&longitude_at_units = "degrees_east"
> >>> v1&longitude_at_units = "degrees_east"
> >>> ;u2&latitude_at_units = "degrees_north"
> >>> ;v2&latitude_at_units = "degrees_north"
> >>> sst1&longitude_at_units = "degrees_east"
> >>> sst1&longitude_at_units = "degrees_east"
> >>> sst2&latitude_at_units = "degrees_north"
> >>> sst2&latitude_at_units = "degrees_north"
> >>>
> >>>
> >>> ;********************************
> >>> ; plot original data
> >>> ;********************************
> >>>
> >>> res_at_tmXBLabelsOn = False ; do not draw bottom labels
> >>> res_at_tmXBOn = False ; no bottom tickmarks
> >>>
> >>> plot(0) = gsn_csm_vector_scalar_map_ce(wks,u1(::stride,::stride),\
> >>> v1(::stride,::stride),sst1(:,:),res)
> >>> ;delete(res_at_tiMainString)
> >>> res_at_tmXBLabelsOn = True ; draw bottom labels
> >>> res_at_tmXBOn = True ; draw bottom tickmarks
> >>> plot(1) = gsn_csm_vector_scalar_map_ce(wks,u2(::stride,::stride),\
> >>> v2(::stride,::stride),sst2(:,:),res)
> >>> resP = True
> >>> resP_at_gsnPaperWidth = 8.5
> >>> resP_at_gsnPaperHeight = 11
> >>> resP_at_gsnPaperOrientation = "portrait"
> >>> ;resP_at_gsnMaximize = True
> >>> resP_at_vpHeightF = .8
> >>> resP_at_vpYF = .95
> >>> gsn_panel(wks,plot,(/2,1/),resP)
> >>> ;maximize_output(wks,resP) ; calls draw and frame for you
> >>> end
> >>>
> >>>
> >>>
> >>>
> >>> ------------------------------------------------------------------------
> >>>
> >>>
> >>> ------------------------------------------------------------------------
> >>>
> >>> _______________________________________________
> >>> ncl-talk mailing list
> >>> ncl-talk_at_ucar.edu
> >>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
Derrick Snowden
PhOD/AOML/NOAA
4301 Rickenbacker Causeway
Miami, FL 33149
Office: 305.361.4322  Fax: 305.361.4392
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 09 2007 - 14:51:57 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 11 2007 - 10:16:54 MST