>
> Dear NCL users:
>
> I am trying to add a labelbar to a plot. I can do this.
> However, I would like to use gsnSpreadColors. I
> can't seem to get this work. I attached my script and
> and a .txt file that contains the set of colors that define
> my color map.Your suggestions would be greatly appreciated.
> Thank you,
> Matt
>
Dear Matt,
The "gsnSpreadColors" resource only works with contours and vectors,
and then the color information is automatically picked up by the
labelbar, when you use the labelbar associated with the plot.
Since you are trying to create a labelbar separately, it will not
recognize the "gsnSpreadColors" resource on its own. It will just pick
up the first "n" colors in your color map ("n" is 7 in your case,
which is the number of boxes). To get your labelbar colors to span the
color map, you need to set the "lbFillColors" resource.
To do this, you first need to know how many colors are in your color
map, and then you need to calculate a nice stride value that will give
you this many colors spaced evenly throughout the color map.
For example, to use part of your code:
...
cmap = RGBtoCmap("$HOME/bin/Ncl/greyscale.rgb") ; greyscale
gsn_define_colormap(wks,cmap)
;
; Calculate a "nice" span of colors.
;
nboxes = 7 ; # of labelbar boxes
clen = dimsizes(cmap(:,0)) ; # of colors in colormap
stride = ((clen-1) - 2) / nboxes ; Start at color index 2 and end
; near color index clen-1.
fill_colors = ispan(2,clen-1,stride)
...
lbres = True
lbres@lbAutoManage = False
lbres@lbFillColors = fill_colors
...
gsn_labelbar_ndc(wks,nboxes,lblabels,0.3,0.05,lbres)
Let me know if this doesn't work for you.
--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Thu May 22 2003 - 08:06:54 MDT