Re: labelbars and panels

From: Mary Haley (haley AT XXXXXX)
Date: Tue Aug 06 2002 - 09:48:45 MDT

  • Next message: Larry McDaniel: "boxplots"

    >
    > Dave,
    >
    > For polar plots, the longitude labels are controlled by txFontHeightF. And,
    > coincidentally, gsnCenterString, gsnLeftString, and gsnRightString are also
    > controlled by txFontHeightF.. I am still working on your label bar question...
    >
    > Adam

    Adam,

    Thanks for handling the gsn*String question.

    As for moving the labelbar, you can do it by setting "vpXF" and
    "vpYF". These values go from 0 to 1 inclusive, where (0.0,0.0)
    represents the lower left corner, and (1.0,1.0) represents the upper
    right corner.

    Thus, to move the labelbar down, you might try setting vpYF to
    something like 0.2 or 0.3. You probably don't need to adjust vpXF,
    unless you don't want the labelbar centered in the X direction.

    The other option, if you don't like the labelbar that gsnPanelLabelBar
    is giving you, is to create your own. Here's a modified version of
    the end of your script, where I turned off the panel labelbar, and created
    one separately. It does involve more work, but it also gives you
    more control:

       ...
      end do

      resPanel = True ; panel mods desired
      resPanel@gsnFrame = False ; don't advance frame
      resPanel@gsnPanelBottom = 0.05
      resPanel@gsnMaximize = True ; fill up the page
      resPanel@gsnPaperOrientation = "auto"
      resPanel@gsnPanelYWhiteSpacePercent = 5
      resPanel@gsnPanelXWhiteSpacePercent = 5

      resPanel@txString = "Z700 Annual Average"
      gsn_panel(pswks,plot,(/1,5/),resPanel) ; draw: 1-down , 5-across

    ;
    ; Get information about contour levels, and fill colors
    ; used so we can use this in the labelbar.
    ;
      getvalues plot@contour
        "cnLevels" : levels
        "cnFillColors" : colors
      end getvalues

      x = 0.1 ; X position of labelbar
      y = 0.4 ; Y position of labelbar

      lbres = True ; Set up labelbar resources.

      lbres@vpWidthF = 0.8 ; Change width and height
      lbres@vpHeightF = 0.2 ; of labelbar.

      lbres@lbOrientation = "Horizontal"
      lbres@lbPerimOn = False

      lbres@lbFillColors = colors
      lbres@lbMonoFillPattern = True ; Use solid fill, not patterns

      lbres@lbLabelAlignment = "InteriorEdges" ; default is "BoxCenters"
      lbres@lbLabelFontHeightF = 0.01

      lbres@lbTitleString = "700 mb Geopotential Height"
      lbres@lbTitleFontHeightF = 0.015

      nboxes = dimsizes(levels)+1

      labels = new(dimsizes(levels),string) ; Convert levels to strings.
      labels = levels

      gsn_labelbar_ndc(pswks,nboxes,labels,x,y,lbres) ; Draw labelbar

      frame(pswks)
    end

    > > Date: Tue, 6 Aug 2002 11:29:21 -0400
    > > From: David Reusch <dbr@essc.psu.edu>
    > > To: Adam Phillips <asphilli@cgd.ucar.edu>
    > > Cc: nicl-talk@ucar.edu
    > > Subject: Re: labelbars and panels
    > > Mime-Version: 1.0
    > > Content-Disposition: inline
    > > User-Agent: Mutt/1.3.27i
    > >
    > > On Tue, Aug 06, 2002 at 09:15:57AM -0600, Adam Phillips wrote:
    > > >Are you putting the pmLabelBarOrthogonalPosF resource in your panel resource
    > > >list (and not in your plot resource list)?
    > > Yes.
    > >
    > > >If you are, can you reply with a copy
    > > >of the plotting section of your program so we can all see it?
    > > Sure, but first maybe you can tell me why the line below doesn't
    > > change the size of longitude labels on my polar plot?
    > >
    > > res@mpLabelFontHeightF = 0.05 ; doesn't work!
    > >
    > > I've also been unable to change the size of the gsnCenterStrings
    > > in each plot.
    > >
    > > Anyway, here's the script (and thanks for all your patience
    > > with the newbie!). -dave
    > >
    > > load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
    > > load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_csm.ncl"
    > > load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
    > > begin
    > > Z700=asciiread("Zsub.txt",(/721/),"float")
    > > ll=asciiread("EASEsub.txt",(/721,2/),"float")
    > > d0 = ll(:,0)
    > > d1 = ll(:,1)
    > > znew = idsfft( d0, d1, Z700, (/30,30/) )
    > > znew!0="lat"
    > > znew!1="lon"
    > > znew&lat@units="degrees_north"
    > > znew&lon@units="degrees_east"
    > >
    > > ; xwks = gsn_open_wks( "x11","test2") ; Open an X11 workstation.
    > > pswks = gsn_open_wks( "ps","test2") ; Open a PS workstation.
    > >
    > > ; gsn_define_colormap(xwks,"temp1") ; choose colormap
    > > gsn_define_colormap( pswks,"temp1") ; just opened.
    > >
    > > res = True
    > > res@gsnDraw = False ; do not draw picture
    > > res@gsnFrame = False ; do not advance frame
    > > res@gsnPolar = "SH"
    > > res@gsnSpreadColors = True ; use full colormap
    > >
    > > res@cnFillOn = True ; turn on color
    > > res@cnInfoLabelOn = False ; turn label off
    > >
    > > res@mpFillOn = False
    > > res@mpDataBaseVersion = "Ncarg4_1"
    > > res@mpOutlineOn = True
    > > res@mpMaxLatF = max(znew&lat) ; zoom in on region
    > > res@mpGridLatSpacingF = 10
    > > ; res@mpLabelFontHeightF = 0.05 ; doesn't work!
    > >
    > > res@lbLabelBarOn = False ; turn off the label bar
    > > res@lbLabelAngleF = 45
    > > res@lbTitleFontHeightF= .015
    > > ; res@lbLabelStride = 2 ; stride on label bar
    > >
    > > res@vpYF = 0.9
    > >
    > > ;************************************************
    > > ; individual plots
    > > ;************************************************
    > > plot = new(15,graphic) ; create graphics array
    > >
    > > ; create a 3x5 array of plots. use the same one for
    > > ; now, until it works.
    > > do n=0,14
    > > res@gsnCenterString = "Plot " + n
    > > ; plot(n) = gsn_csm_contour_map_polar(xwks,znew,res)
    > > plot(n) = gsn_csm_contour_map_polar(pswks,znew,res)
    > > end do
    > >
    > > ;************************************************************
    > > ; now create panel plot with its own resources
    > > ;************************************************************
    > > resPanel = True ; panel mods desired
    > > resPanel@gsnFrame = False ; do not advance frame
    > > resPanel@gsnPanelBottom = 0.05
    > > resPanel@gsnPanelLabelBar= True ; label bar on panel
    > > resPanel@gsnMaximize = False ; fill up the page
    > > resPanel@gsnPaperOrientation = "auto"
    > > resPanel@gsnPanelYWhiteSpacePercent = 3
    > > resPanel@gsnPanelXWhiteSpacePercent = 3
    > >
    > > resPanel@txString = "Z700 Annual Average"
    > > resPanel@lbLabelAngleF = 45
    > > resPanel@lbTitleOn = True ; turn on title
    > > resPanel@lbTitleString = "700 mb Geopotential Height"
    > > resPanel@lbTitleFontHeightF= .01
    > > resPanel@lbAutoManage= False
    > > resPanel@lbLabelFontHeightF= .01
    > > resPanel@pmLabelBarOrthogonalPosF = .10
    > > ; gsn_panel(xwks,plot,(/3,5/),resPanel) ; draw: 3-down , 5-across
    > > gsn_panel(pswks,plot,(/3,5/),resPanel) ; draw: 3-down , 5-across
    > > frame(pswks)
    > >
    > > end
    >
    > -------------------------------------------------------------
    > Adam Phillips email: asphilli@ucar.edu
    > Climate and Global Dynamics Division tel: (303) 497-1726
    > National Center for Atmospheric Research fax: (303) 497-1333
    > P.O. Box 3000
    > Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli
    >
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Tue Aug 06 2002 - 09:54:11 MDT