[ncl-talk] How do I color fill a map using transparent colors for part of the range?
Rick Brownrigg
brownrig at ucar.edu
Fri Jun 7 09:55:59 MDT 2019
Hi Cathy,
the function read_colormap_file() can be used to read a colormap; it always
returns an Nx4 array, where the rightmost dimension holds the red, green,
blue, alpha channels. Alpha controls translucency, where 0.0 is completely
transparent and 1.0 is completely opaque. You can assign that colormap to
the resource cnFillColors to be used for your contour map.
http://ncl.ucar.edu/Document/Functions/Built-in/read_colormap_file.shtml
This would be one way to set the first three levels to transparent.
Determining which color indices get mapped to the first three contour
levels could be tricky, however -- it may not be as simple as the first
three color entries, particularly is cnSpanFillPalette is True.
Hope that helps...
Rick
On Fri, Jun 7, 2019 at 1:14 AM Toni Klemm <toni-klemm at tamu.edu> wrote:
> Hi Cathy,
>
> I had a similar problem before. It might work to duplicate the variable
> and replace the categories you want to be transparent with missing values.
> That way they won’t be colored.
>
> Good luck,
> Toni
>
>
> *Toni Klemm**, Ph.D.*
> Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> College of Agriculture and Life Sciences
> Texas A&M University, College Station, TX
> Contributor to the Early Career Climate Forum <https://www.eccforum.org/>
> www.toni-klemm.de | @toniklemm <https://twitter.com/ToniKlemm>
>
>
> On Jun 6, 2019, at 11:35 PM, Cathy Smith <cathy.smith at noaa.gov> wrote:
>
> NCLers
>
> I am hoping I missed this in the doc. I'd like create a map that is
> colorfilled (either contour or raster). I would like the lowest 3 contour
> ranges to be transparent and the rest not. I can't figure out how to do
> this. I tried overlay and I wasn't able to not color part of a map so the
> overlay worked. Also, I don't see you can set an array of transparency for
> each color.
>
> Any suggestions would be appreciated.
>
> Cathy Smith
>
> --
> ----------------------------------------------
> NOAA/ESRL PSD and CU CIRES
> 303-497-6263
> https://www.esrl.noaa.gov/psd/people/cathy.smith/
>
> Emails about data/webpages may get quicker responses from emailing
> esrl.psd.data at noaa.gov
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190607/a8638b98/attachment.html>
More information about the ncl-talk
mailing list