Hi Erwan,
One of the best things about NCL is that you can do practically anything
with the graphics. Unfortunately, you have come upon one of the few
things that you cannot change. There is currently no way that this can
be done in NCL, beyond setting it manually. (Very frustrating.)
This feature has been requested a few times in the past by Dennis, and I
see that it is on the NCL developers priority list but it is farther
down that Dennis or I would like it to be. We will push to get this
implemented in the near future.
In the meantime, I would suggest the following:
1) Set lbLabelFontHeightF, and set cnM**LevelValF = -0.8/0.8
2) Use drawNDCGrid to draw the NDC grid on the workstation:
http://www.ncl.ucar.edu/Document/Functions/Shea_util/drawNDCGrid.shtml
3) Create a text resource list and set the font height = to the label
bar label font height. Then use gsn_text_ndc to add the labels.
ex.
...
pres_at_cnLevelSelectionMode = "ManualLevels" ; manual contour levels
pres_at_cnMinLevelValF = -1 ; min level
pres_at_cnMaxLevelValF = 1 ; max level
pres_at_cnLevelSpacingF = 0.2 ; contour level spacing
pres_at_lbLabelFontHeightF = 0.015
pres_at_gsnFrame = False
...
plot = gsn_csm_contour_map_ce(wks,arr,res)
txres = True
txres_at_txFontHeightF = pres_at_lbLabelFontHeightF
gsn_text_ndc(wks,"-1.0",0.4,0.3,txres)
gsn_text_ndc(wks,"1.0", 0.6,0.3,txres)
drawNDCGrid() ; load shea_util.ncl to use
frame(wks)
end
Good luck,
Adam
Erwan Monier wrote:
> Hi,
>
> I am dealing with a 2D-field scaled so that its values are between -1
> and 1. When I plot it and manually define the max and min level values
> of my label bar to -1 and 1 (see script below), I get a label bar with
> two extra color boxes, for values below -1 and above 1. Therefore, when
> I use a gray scale color map with white in the middle and black for the
> extreme values, the black colors are used for values below -1 and above
> 1. However since my data is all between -1 and 1, the black color is
> never used. I would like to have black color for values between -1 and
> -0.8, and between 0.8 and 1, as well as no extra color boxes on my label
> bar. Is there a way to achieve that?
>
> I have tried to set the min and max values to -0.8 and 0.8, but then
> there is no label string for -1 and 1. Setting cnLabelBarEndLabelsOn to
> True is an option, but it doesn't work with common label bars, at least
> it didn't display any values when I tried.
>
> Is there any way to solve that problem ? Thank you...
>
>
> pres_at_cnLevelSelectionMode = "ManualLevels" ; manual contour levels
> pres_at_cnMinLevelValF = -1 ; min level
> pres_at_cnMaxLevelValF = 1 ; max level
> pres_at_cnLevelSpacingF = 0.2 ; contour level spacing
>
> Erwan Monier
> Atmospheric Science Program
> University of California Davis
> http://atm.ucdavis.edu/~emonier/ <http://atm.ucdavis.edu/%7Eemonier/>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Tue Jan 30 2007 - 12:09:42 MST
This archive was generated by hypermail 2.2.0 : Tue Feb 06 2007 - 15:01:34 MST