[ncl-talk] confused about label bar

Mary Haley haley at ucar.edu
Fri Jun 17 08:37:35 MDT 2016


Hi Laura,

The labelbar can indeed be confusing.

What you are running into is that the gsn_csm_contour_xxxx scripts all
internally set the labelbar resource "lbLabelAlignmentMode" to
"InteriorEdges", which is different from NCL's default of "BoxCenters".
 gsn_create_labelbar uses the NCL default of "BoxCenters", which means that
you have the same number of labels as you do boxes.

In order to get 26 boxes with 25 labels, you need to tell
gsn_create_labelbar that you want "nlevels+1" boxes, and you also need to
set lbLabelAlignment:

    lbres at lbLabelAlignment = "InteriorEdges"

    lbid = gsn_create_labelbar(wks,nlevels+1,labels,lbres)

I'll try to add an example on our labelbars page soon.

--Mary




On Thu, Jun 16, 2016 at 11:42 AM, Laura Fowler <laura at ucar.edu> wrote:

> Hello:
>
> I am trying to create a label bar from scratch using the color table
> "BlAqGrYeOrReVi200". I create 25 equally-spaced levels spanning
> between 100 and 340 with an interval of 10. Using span_color_indexes,
> I create 26 colors
>
> Variable: colors
>
> Type: integer
> Total Size: 104 bytes
>             26 values
> Number of Dimensions: 1
> Dimensions and sizes: [26]
> Coordinates:
>
> (0) 3
> (1) 11
> (2) 19
> (3) 27
> (4) 35
> (5) 43
> (6) 51
> (7) 58
> (8) 66
> (9) 74
> (10) 82
> (11) 90
> (12) 98
> (13) 106
> (14) 114
> (15) 122
> (16) 130
> (17) 138
> (18) 146
> (19) 153
> (20) 161
> (21) 169
> (22) 177
> (23) 185
> (24) 193
> (25) 201
>
> I do not understand why the color bar only shows 25 colors and not 26.
> Also, I thought that the location of the label "100" would be located
> on the right edge of the firtst box on the left, as usually seen in
> most examples on the Label Bar web page. Can somebody clarify what I
> am doing wrong. The pdf is
> /glade/p/work/laura/DATA/CERESdata/CERESorbits.2014-01-10_to_2014-01-14
> (plot_CERES_SSF_XTRK-MODIS_Edition4A_original_data_markers.pdf) and
> the ncl script is
> CERES_SSF_XTRK-MODIS_Edition4A_Subset_plot_original_data_with_marker.ncl.
>
> Thanks,
> Laura
>
>
>
>
> --
>
> !-------------------------------------------------------------------------------------------------------------
> Laura D. Fowler
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
>
> !-------------------------------------------------------------------------------------------------------------
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160617/85287fe6/attachment.html 


More information about the ncl-talk mailing list