[ncl-talk] control legend values

mireiyue mireiyue at gmail.com
Sun Sep 11 17:03:43 MDT 2016


Thank you Adam
It works!!

Sun-
> On Sep 10, 2016, at 12:09 AM, Adam Phillips <asphilli at ucar.edu> wrote:
> 
> Hi Sun,
> Here's how I would do it:
> gsn_define_colormap(wks,"ViBlGrWhYeOrRe”) 
> res = True
> ....
> res at cnLevelSelectionMode = "ExplicitLevels"
> res at cnLevels=(/-1000,-500,0,1000,5000,10000/) ; explicitly set contour levels
> res at cnFillOn = True
> res at cnFillColors = (/12,27,0,0,63,75,95/)
> 
> Set the cnLevels to whatever you want, and then set the number of cnFillColors to one more than the number of cnLevels. The integers that I set in cnFillColors were chosen from the ViBlGrWhYeOrRe colormap website here:
> http://www.ncl.ucar.edu/Document/Graphics/ColorTables/ViBlGrWhYeOrRe.shtml <http://www.ncl.ucar.edu/Document/Graphics/ColorTables/ViBlGrWhYeOrRe.shtml>
> 
> Color 12 is a blue, 27 is a blueish green, and so on. I set 0 (=background color/white) for all areas greater than or equal to -500 and less than 0, as well as all areas greater than or equal to 0 and less than 1000. (Note: I could have specified color 52 instead of 0 as 52 also looks white.) 
> 
> I don't know if you want to have -1000 and 10000 be the absolute minimum and maximum values on your labelbar. If so, see labelbar example #14 here (3rd panel):
> http://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14 <http://www.ncl.ucar.edu/Applications/labelbar.shtml#ex14>
> 
> Note that when you set lbLabelAlignment = "ExternalEdges" you will have to set the lbLabelStrings resource as the example shows. If you go with ExternalEdges some trial and error is likely needed to get the labelbar to exactly where you want it to be.
> 
> Hope that helps. If you have further questions please respond to ncl-talk.
> Adam
> 
> 
> 
> 
> 
> 
> On Thu, Sep 8, 2016 at 12:03 PM, mireiyue <mireiyue at gmail.com <mailto:mireiyue at gmail.com>> wrote:
> Dear NCL users,
> 
> I want to create a legend that shows minimum -1000 and maximum 10000. I want to have different interval for negative and positive values. And I am using gsn_define_colormap(wks,"ViBlGrWhYeOrRe”) and I want to put white color for zero.
> 
> I haven’t found any information about this work.
> 
> I will appreciate any related helps and comments.
> 
> Thank you
> Sun-
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
> 
> 
> 
> -- 
> Adam Phillips 
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ <http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726
> 
>  <http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160912/128f3212/attachment.html 


More information about the ncl-talk mailing list