Re: plot contourr lines with different colors

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 15 2013 - 12:07:34 MDT

Adding a bit to Adam's reply: if you have NCL 6.1.0 or later, you can set the new resource cnLinePalette with the name of a color table (such as gui_default), but the colors will automatically span the color table. You can
control whether the color table is spanned or each line is given the next sequential color in the color map by setting the logical resource cnSpanLinePalette (default is True).
 -dave

On Oct 15, 2013, at 11:57 AM, Adam Phillips <asphilli@ucar.edu> wrote:

> Hi Erika,
> You do not need to set cnLineColors, but that means NCL will choose the line colors based on the the colormap you are using. You lose some control that way. If cnLineColors are not set and you are using "gui_default", your first contour will be colored gui_default color #2 (blue), the second contour will be colored gui_default color #3 (a slightly lighter blue), and so on. Once the end of the colormap is reached, NCL will start over with gui_default color #2, proceed to color #3, and so on..
> Adam
>
> On 10/15/2013 11:50 AM, Erika Folova wrote:
>> Thank you for the response,
>>
>> In this case, I will use the color table of "gui default",
>> anyway I just wonder is there any automatic resource associated to the cnLevels, that can do this without using
>> res@cnLineColors = (/2,4,8,11/), I mean it's gonna be a bit inconvenience to set each color, one by one
>> if i have large interval contors in res@cnLevels= (1,2,3,4,...50).
>>
>> Thank you
>> Erika
>>
>>
>>
>>
>> On Wed, Oct 16, 2013 at 2:08 AM, Adam Phillips <asphilli@ucar.edu> wrote:
>> Hi Erika,
>> Yes, you need to set cnMonoLineColor = "False" and set cnLineColors. See the cnLineColors description here:
>> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnLineColors
>>
>> here's a brief example:
>>
>> wks = gsn_open_wks("x11","test")
>> gsn_define_colormap(wks,"Cat12")
>>
>> res = True
>> ....
>> res@cnLevelSelectionMode = "ExplicitLevels"
>> res@cnLevels = (/1,2,3,4/)
>> res@cnMonoLineColor = False
>> res@cnLineColors = (/2,4,8,11/)
>> plot = gsn_csm_xy(wks,arr&time,arr,res)
>>
>> Hope that helps. If not, please respond to the ncl-talk email list..
>> Adam
>>
>>
>> On 10/15/2013 11:03 AM, Erika Folova wrote:
>>> Hallo,
>>>
>>> I just wonder is it possible to draw the contour lines (as attached) with different color options
>>> in NCL? Thank you for your response.
>>>
>>> Erika
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> --
>> ______________________________________________________________
>> Adam Phillips asphilli@ucar.edu
>> NCAR/Climate and Global Dynamics Division (303) 497-1726
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> ______________________________________________________________
> Adam Phillips asphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 15 12:07:43 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 22 2013 - 10:35:27 MDT