[ncl-talk] colorbar that's part grayscale, part color?

Jared Lee jaredlee at ucar.edu
Tue Feb 13 13:51:08 MST 2018


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 (w)
Web: https://staff.ucar.edu/users/jaredlee
===============================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180213/67d57b36/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WRF_d01_T_k=0_20160121_1200_ch1.png
Type: image/png
Size: 633091 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180213/67d57b36/attachment-0001.png>


More information about the ncl-talk mailing list