Re: Color bar positioning problem

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 1 May 2009 15:00:48 -0600 (MDT)

Hi Oliver,

I think it's the lbAutoManage resource that is causing problems
here. I admit that I don't understand the behavior of this resource
very well. It was getting set to False internally, but only
after the labelbar was already created, which was too late.

I think I've fixed the problem. See the attached "newbar.ncl" script.

You'll need to load this after "shea_util.ncl":

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "./newbar.ncl"

See what happens when you alternately set r_at_lbAutoManage to True
or False. If you set to False, you should see that your labels
are the actual size expected.

Thanks for providing a sample script!

--Mary

On Fri, 1 May 2009 Oliver.Fuhrer_at_meteoswiss.ch wrote:

> <<SnagIt1.png>> Hi all!
>
> I'm trying to position a color bar on my plot using NDC coordinates. The
> color bar seems to shift around rather unexpectedly with changing the
> label font size (see attached png). Is this a bug or a feature? If the
> latter, how can I manage to position my color bar exactly in NDC
> coordinates?
>
> Thanks,
> Oli
>
>
> -------- cbarproblem.ncl ------------
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
>
> ; define workspace
> wks_type = "ps"
> wks_type_at_wkOrientation = "landscape"
> wks = gsn_open_wks(wks_type, "cbarproblem")
> gsn_define_colormap(wks,"cosam12")
> map = gsn_retrieve_colormap(wks)
>
> ;draw grid
> drawNDCGrid(wks)
>
> ; draw labelbar
> levels = fspan(1.0,12.0,12)
> labels = levels+""
> r = True
> r_at_lbPerimOn = False
> r_at_lbBottomMarginF = 0.0
> r_at_lbTitleOn = False
> r_at_lbTopMarginF = 0.0
> r_at_lbLeftMarginF = 0.0
> r_at_lbRightMarginF = 0.0
> r_at_lbJustification = "TopLeft"
> r_at_lbOrientation = "Vertical"
> r_at_lbAutoManage = False
> r_at_vpWidthF = 0.1
> r_at_lbBoxMinorExtentF = 0.2
> r_at_lbLabelsOn = True
> r_at_lbLabelAlignment = "InteriorEdges"
> r_at_lbLabelJust = "CenterLeft"
> r_at_lbMonoFillPattern = True
> r_at_lbFillColors = map(1:dimsizes(levels),:)
> r_at_vpHeightF = 0.4
> ypos = 0.8
> do i=0,3
> xpos = 0.2 + 0.2*i
> if (i.eq.0) then
> r_at_lbLabelFontHeightF = 0.01
> end if
> if (i.eq.1) then
> r_at_lbLabelFontHeightF = 0.02
> end if
> if (i.eq.2) then
> r_at_lbLabelFontHeightF = 0.05
> end if
> if (i.eq.3) then
> r_at_lbLabelFontHeightF = 0.1
> end if
> gsn_labelbar_ndc(wks,dimsizes(levels)+1,labels,xpos,ypos,r)
> end do
> delete(levels)
> delete(labels)
> delete(r)
> delete(map)
>
> ; finish plot
> frame(wks)
> delete(wks)
>
> end
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri May 01 2009 - 15:00:48 MDT

This archive was generated by hypermail 2.2.0 : Fri May 01 2009 - 15:10:00 MDT