Re: sizing labels and numbers on right axis

From: Ethan Alpert (ethan@XXXXXX)
Date: Wed Jun 09 1999 - 11:38:45 MDT


Harry and [ngtalk],

        Dave K. answered your question about autograph and I thought I'd
demonstrate to the group how the same plot can be created using NCL.
Enclosed is a script that creates the plot and sets all fonts and font
heights equal. Keep in mind that all the resources that set the font information
can be put into an external resource file which can be applied every
time you run NCL thus reducing the amount of typing necessary to create
this plot. If anyone would like an example of the following script that
uses an external resource file let me know. Cut below the line and
save to a file.

To run:
        
        ncl < filename

        -ethan
--------------------------------------------------------------------------------
begin
;
; create dummy data
;
        ydra = new((/2,2000/),float)
        xdra = ispan(1,2000,1)
        ydra(0,:) = (cos(xdra*3.14159/1000)+1.)
        ydra(1,:) = (sin(xdra*3.14159/1000)+1.)
;
; create variables for font information as well as tick size
; so one change affects all
;

        font = "default"
        fontsize = .013
        majorticksize = .007
        minorticksize = .003
;
; open workstation
        wks = create "wks" xWorkstationClass defaultapp
                "wkPause" : True
        end create
;
; define curve data
;
        curves = create "curve" coordArraysClass defaultapp
                "caXArray" : xdra
                "caYArray" : ydra
        end create
;
; compute inch label locations and minor tick locations
;
        inches = fspan(0.0,100.0,11) * .0254
        minor_inches = inches(0:9) + (10*.0254)/2.0

        xyplot = create "xyplot" xyPlotClass wks
;
; assign curve data
                "xyCoordData" : curves
;
; Turn on and set up titles
;
                "pmTitleDisplayMode" : "ALWAYS"
                "tiMainString" : "TAYLOR SLOUGH BRIDGE"
                "tiYAxisString" : "WATER SURFACE ELEVATION (METERS)"
                "tiXAxisString" : "POINT FROM START OF RECORD"
;
; Seperate control of left and right tickmarks
;
                "tmYUseLeft" : False
;
; set up right tickmarks
;
                "tmYRLabelsOn" : True
                "tmYRMode" : "EXPLICIT"
                "tmYRValues" : inches
                "tmYRMinorValues" : minor_inches
                "tmYRLabels" : fspan(0.0,100.0,11)
;
; set up left tickmarks
;
                "tmYLMode" : "MANUAL"
                "tmYLTickStartF" : 0.0
                "tmYLTickEndF" : 2.2
                "tmYLTickSpacingF" : .2
                "tmYLMinorPerMajor" : 1
;
; set up bottom tickmarks
;
                "tmXBMode" : "MANUAL"
                "tmXBTickStartF" : 0.0
                "tmXBTickEndF" : 2000.
                "tmXBTickSpacingF" : 200.0
                "tmXBMinorPerMajor" : 1
                "trXMaxF" : 2000.
                "trXMinF" : 0.
                "trYMaxF" : 2.2
                "trYMinF" : 0.0
        end create
;
; create an annotation for the right side
;
        tx = create "tx" textItemClass wks
                "txFont" : font
                "txFontHeightF" : fontsize
                "txString" : "INCHES"
                "txAngleF" : 90.0
        end create

        anno = NhlAddAnnotation(xyplot,tx)

        setvalues anno
                "amZone" : 5
                "amSide" : "RIGHT"
                "amParallelPosF" : .5
                "amOrthogonalPosF" : .02
        end setvalues
;
; Set up all size and font information
;
        setvalues xyplot
                "vpXF" : .1
                "vpWidthF" : .8
                "vpYF" : .75
                "vpHeightF" : .4
                "tiMainFontHeightF" : fontsize
                "tiYAxisFontHeightF" : fontsize
                "tiMainFontHeightF" : fontsize
                "tiXAxisFontHeightF" : fontsize
                "tmXBMajorLengthF" : majorticksize
                "tmYLMajorLengthF" : majorticksize
                "tmYRMajorLengthF" : majorticksize
                "tmXBMinorLengthF" : minorticksize
                "tmYLMinorLengthF" : minorticksize
                "tmYRMinorLengthF" : minorticksize
                "tmXBLabelFontHeightF" : fontsize
                "tmYLLabelFontHeightF" : fontsize
                "tmYRLabelFontHeightF" : fontsize
                "tmXBLabelFont" : font
                "tmYLLabelFont" : font
                "tmYRLabelFont" : font
                "tiYAxisFont" : font
                "tiXAxisFont" : font
                "tiMainFont" : font
        end setvalues
        draw(xyplot)
        frame(wks)
end



This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 09:45:44 MDT