Re: labelbars and panels

From: Mary Haley (haley AT XXXXXX)
Date: Tue Aug 06 2002 - 07:41:55 MDT

  • Next message: David Reusch: "Re: labelbars and panels"

    >
    > I am having trouble with labelbars and panel plots
    > with more than 3 plots in a row. No matter what I
    > do (e.g., adjusting gsnPanelBottom), the labelbar
    > overlaps the row of plots whenever more than 3 plots
    > are in the row. This is awkward since I need to
    > have 5 plots per row (and, ultimately, 3 rows). The
    > number of rows doesn't seem to matter and gsnPanelBottom
    > doesn't help (it just adds white space at the bottom
    > and the label bar doesn't use it).

    Dave,

    Sylvia Murphy has a whole page dedicated on how to create
    labelbars using the gsn_csm templates. Please go to:

    http://www.cgd.ucar.edu/csm/support/CSM_Graphics/labelbar.shtml

    and in particular, look at example 3 which shows how to move the
    labelbar away from the plot (using the "pmLabelBarOrthogonalPosF"
    resource).

    > Also, I'd like to know how to get variable values
    > into a plot title. I tried:
    > res@gsnCenterString = "Plot $n$"
    > but it doesn't work.

    You can use "+" operator, which serves as a string concatenator when
    used with strings:

      res@gsnCenterString = "Plot " + n

    NCL will convert the value of "n" to a string, and then concatenate it
    to the string "Plot ".

    If you need to format a variable when writing it to a string,
    you can use the "sprinti" and "sprintf" functions to format
    integers and floats respectively. For more information, see
    their web pages at:

      http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/sprinti.html
      http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/sprintf.html

    --Mary

    > thanks,
    > dave reusch
    > dbr AT geosc.psu.edu
    >
    > ----------
    > 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"
    >
    > pswks = gsn_open_wks( "ps","test2") ; Open a PS workstation.
    >
    > gsn_define_colormap( pswks,"temp1") ; just opened.
    >
    > res = True
    > res@gsnDraw = False ; do not draw picture
    > res@gsnFrame = False ; do not advance frame
    > res@cnFillOn = True ; turn on color
    > res@gsnPolar = "SH"
    > res@mpFillOn = False
    > res@cnInfoLabelOn = False ; turn label off
    > res@lbLabelBarOn = False ; turn off the label bar
    > res@mpOutlineOn = True
    > res@vpYF = 0.9
    > ;
    > res@lbLabelAngleF = 45
    > res@lbTitleFontHeightF= .015
    > res@gsnSpreadColors = True ; use full colormap
    >
    > res@mpMaxLatF = max(znew&lat) ; zoom in on region
    >
    >
    > ;************************************************
    > ; individual plots
    > ;************************************************
    > plot = new(5,graphic) ; create graphics array
    >
    > do n=0,4
    > 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@gsnPanelBottom = 0.05
    > resPanel@gsnPanelLabelBar= True ; label bar on panel
    > resPanel@gsnMaximize = True ; fill up the page
    > resPanel@gsnPaperOrientation = "auto"
    > resPanel@gsnPanelYWhiteSpacePercent = 5
    > resPanel@gsnPanelXWhiteSpacePercent = 5
    >
    > 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
    > gsn_panel(pswks,plot,(/1,5/),resPanel) ; draw: 1-down , 5-across
    >
    > end
    > _______________________________________________
    > ncl-talk mailing list
    > ncl-talk AT ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >

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



    This archive was generated by hypermail 2b29 : Tue Aug 06 2002 - 07:45:08 MDT