Re: a question about color for overlapped plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 20 Jan 2006 08:05:16 -0700 (MST)

Hi Xianglei,

I assume you have gsnSpreadColors set to True? If so, then by default
NCL will try to span the full color map for your contour plot, and
that's why you are seeing green in your contours.

To avoid this, you can set:

    res_at_gsnSpreadColorsEnd = -2

This tells NCL to only use up to the second-to-the-last color in the color
map (the default for this resource is -1, which is the last color in
the color map). Since your last color is green (NhlNewColor always adds
colors to the end of your colormap), then hopefully the value of "-2"
should do it.

--Mary

On Thu, 19 Jan 2006, Xianglei Huang wrote:

> Hi Adam,
>
> Thanks for the tips. I tried (1) and it did change the color of
> steamlines. However, at the same time it also changes the contour plot.
> Originally I tried to use blue & red to fill contours and green to do
> streamlines--so contour patches and streamlines can vividly seperate from
> each other. Now if I add green as a new color to colormap, green will be used
> to fill contour patches as well. Any ideas how I can fix this? Thanks.
>
> Xianglei
>
> On Thu, 19 Jan 2006, Adam Phillips wrote:
>
>> Hi Xianglei,
>>
>> When you set your colormap to the BlueRed colormap, and then ask NCL to
>> grab the color green, NCL will try to get the color in your colormap
>> closest to green. In your case that would be black. There are two possible
>> solutions to this:
>> 1) Use the function NhlNewColor to add the color green to your colormap.
>> gsn_define_colormap(wks,"BlueRed")
>> newcolor = NhlNewColor(wks,0.,1.0,0.)
>>
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/NhlNewColor.shtml
>>
>> 2) Merge another colormap that has green in it with the BlueRed colormap
>> using gsn_merge_colormaps:
>>
>> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_merge_colormaps.shtml
>>
>> Specifically, refer to the first example. Instead of specifiying gray
>> colors specify a green color or two. Remember that NCL has a 256 color
>> limit, so in your case you can only add 2 colors to your colormap..
>>
>> Good luck,
>> Adam
>>
>> Xianglei Huang wrote:
>>> Hi All,
>>>
>>> I am trying to use gsn_csm_streamline_contour_map_ce to creat a color
>>> contour plot overlapped with a streamline vector plot. I found that, after
>>> I choose colormap for contour plot, I cannot set the color of the
>>> streamlines as I want. For example, if I set
>>> gsn_define_colormap(wks,"BlueRed")
>>>
>>> And then if I try to plot streamlines in green by
>>> res_at_stLineColor = "green1"
>>>
>>> It will only plot out the streamlines in black. I tried other named
>>> color as well, the only color working as named is "white". All others
>>> cannot be plotted as named.
>>>
>>> Anyone know how I can go around this? Your help will be highly
>>> appreciated. Thanks.
>>>
>>> Xianglei
>>>
>>> -------------------------------------------------
>>> Xianglei Huang
>>> Princeton AOS Postdoctoral Research Associate
>>> NOAA Geophysical Fluid Dynamics Laboratory
>>> Princeton University Forrestal Campus
>>> 201 Forrestal Road
>>> Princeton, NJ 08540
>>>
>>> xianglei.huang_at_noaa.gov, xianglei_at_princeton.edu
>>> 609-452-6500 extension 6951 (office)
>>> 609-987-5063 (fax)
>>> http://www.princeton.edu/~xianglei
>>> -------------------------------------------------
>>>
>>> _______________________________________________
>>> 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-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 20 2006 - 08:05:16 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 20 2006 - 08:44:50 MST