[ncl-talk] colorbar that's part grayscale, part color?
Adam Phillips
asphilli at ucar.edu
Tue Feb 13 14:41:03 MST 2018
Hi Jared,
To add to Rashed's suggestions:
You can set cnFillColors to exactly the colors you want, via named colors,
indexes from a color map, or RGB or RGBA values.
http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillColors
See numerous examples here: (Search on the page for "cnFillColors")
http://www.ncl.ucar.edu/Applications/res_list.shtml
To answer your query: You can use getvalues to return the colors used in a
specific plot:
plot = gsn_csm_contour_map(.....
getvalues plot at contour ; use plot at contour for contour plots created
using gsn_*_map, otherwise just use "plot"
"cnFillColors" : fill_colors
end getvalues
print(fill_colors)
Hope that helps!
Adam
On Tue, Feb 13, 2018 at 1:51 PM, Jared Lee <jaredlee at ucar.edu> wrote:
> Hi Rashed,
>
> Thanks for the example! That method works fine if you have your threshold
> contour line (0ºC, say) is exactly in the middle of your set of contour
> lines, but not if you have different numbers of contours above and below
> your threshold value to split the colorbars/colormaps, unfortunately. And
> it also limits you to combining colormaps that would total no more than 256
> colors.
>
> What I ended up doing to get a similar effect (though not explicitly
> blending two colormaps) was to play with cnFillPatterns and make the
> contour intervals below 0ºC be either cross-hatched or stippled (and
> cnFillScaleF changes the stipple density), as in the attached image (note
> that cnFillMode must be set to "AreaFill" to use fill patterns). That might
> be my compromise solution, at least for now.
>
> It would still be nice to be able to return the names of colors (or RBGA
> values) that are assigned to the various contour levels (after setting
> cnFillPalette to a named colormap and setting cnMinLevelValF,
> cnMaxLevelValF, and cnLevelSpacingF), and then explicitly supply different
> color names (or opacities) for some of the intervals. I'm not sure how to
> return the names of colors that are actually being used with a given set of
> contour levels, though.
>
> Jared
>
> On Mon, Feb 12, 2018 at 6:50 PM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> Hi Jared,
>> I think it's easy combine two color maps to get what you want. See
>> attached script and the figure. the input file is NCEP surface air
>> temperature.
>>
>> Cheers,
>> Rashed
>>
>>
>> On Mon, Feb 12, 2018 at 4:33 PM, Jared Lee <jaredlee at ucar.edu> wrote:
>>
>>> Hi all,
>>>
>>> Has anyone out there made any plots where the colorbar/colormap is part
>>> grayscale, part color? For example, what I'd like to do for one application
>>> is make some plots with a color palette like "NCV_bright," for instance,
>>> where temperatures below 0ºC (say) get plotted in a grayscaled version of
>>> the color palette, but grid cells with values above 0ºC get plotted with
>>> the regular full-color palette. How would I go about doing that? Would I
>>> have to manually replace the sub-zero part of my color palette with various
>>> named gray colors? Thanks for any tips or ideas!
>>>
>>> Jared
>>>
>>> --
>>> ===============================
>>> Jared A. Lee, Ph.D.
>>> Project Scientist I
>>> Research Applications Laboratory
>>> National Center for Atmospheric Research
>>> Boulder, Colorado, USA
>>>
>>> Member, AMS Planning Commission
>>>
>>> Email: jaredlee at ucar.edu (w)
>>> Phone: 303.497.8485 <(303)%20497-8485> (w)
>>> Web: https://staff.ucar.edu/users/jaredlee
>>> ===============================
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
>
> --
> ===============================
> Jared A. Lee, Ph.D.
> Project Scientist I
> Research Applications Laboratory
> National Center for Atmospheric Research
> Boulder, Colorado, USA
>
> Member, AMS Planning Commission
>
> Email: jaredlee at ucar.edu (w)
> Phone: 303.497.8485 <(303)%20497-8485> (w)
> Web: https://staff.ucar.edu/users/jaredlee
> ===============================
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
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/20180213/093e7f11/attachment.html>
More information about the ncl-talk
mailing list