[ncl-talk] Changing a color in a color table to transparent

Rashed Mahmood rashidcomsis at gmail.com
Tue Apr 10 18:41:49 MDT 2018


I think there is typo, replace:
From:
cmap(10:11,)        = 0.0

to cmap(10:11,:)        = 0.0

If at later stage you are using "gsn_define_colormap" then it should be:
cmap(10:11,0:2)        = 0.0

Cheers,
Rashed



On Tue, Apr 10, 2018 at 4:55 PM, Ty Buckingham <
ty.buckingham at manchester.ac.uk> wrote:

> Hi there,
>
> Is it possible to change a single color in an already constructed color
> map to transparent?
>
> As an example: I wish to use the "hotcold_18lev" color table, but wish to
> change the white to transparent. I do not have editing permission to the
> NCARG root hence cannot change the RGBA value directly. Is it possible to
> change it within the NCL script?
>
> Initially, I tried this:
>
> cmap                = read_colormap_file("hotcold_18lev")
>
> cmap(10:11,)        = 0.0                ; makes whites transparent
>
> res at cnFillColors    = cmap
>
>
> Yet received the error:
>
>
> fatal:Error in subscript, normal subscripting is being used, make sure
> named subscripting has not been used
>
>
> which is related to the "cmap(10:11,)" line.
>
>
> Thanks in advance!
>
> Ty
>
> _______________________________________________
> 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/20180410/94257a8e/attachment.html>


More information about the ncl-talk mailing list