Re: self defined colormap

From: Adam Phillips (asphilli AT XXXXXX)
Date: Mon Aug 16 2004 - 09:36:26 MDT

  • Next message: David Brown: "Re: self defined colormap"

    Hi Liz,

    You can use a function called gsn_retrieve_colormap to do what you want:

            wks = gsn_open_wks("ps","fig2")
            gsn_define_colormap(wks,"BlWhRe") ;Define the color map

            colors = gsn_retrieve_colormap(wks) ;Retrieve selected color map
            print(dimsizes(colors)) ;for editing purposes
            nu = dimsizes(colors)
            numb = nu(0) ;103 colors in colormap
            cmap = new ((/numb+1,3/),float) ;create new array with 104 colors
            cmap(:52,:) = colors(:52,:) ;keep the first 53 colors the same
            cmap(53,:) = colors(52,:) ;assign 53 the same color as 52 (white)
            cmap(54:,:) = colors(53:,:) ;assign the rest of the colors
            gsn_define_colormap(wks,cmap) ;redefine the colormap

    (I haven't tested this, but I think it is the way to go.)

    Good luck...
    Adam

    >Delivered-To: asphilli@ucar.edu
    >Delivered-To: ncl-talk@ucar.edu
    >Date: Mon, 16 Aug 2004 09:14:35 -0600
    >From: Liangying Zhang <lzhang@ucar.edu>
    >User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
    >X-Accept-Language: en-us, en
    >MIME-Version: 1.0
    >To: ncl-talk@ucar.edu
    >Subject: self defined colormap
    >X-BeenThere: ncl-talk@ucar.edu
    >X-Mailman-Version: 2.1.1
    >List-Id: NCAR Command Language User Group <ncl-talk.ucar.edu>
    >List-Unsubscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
    <mailto:ncl-talk-request@ucar.edu?subject=unsubscribe>
    >List-Post: <mailto:ncl-talk@ucar.edu>
    >List-Help: <mailto:ncl-talk-request@ucar.edu?subject=help>
    >List-Subscribe: <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>,
    <mailto:ncl-talk-request@ucar.edu?subject=subscribe>
    >X-Spam-Status: No, hits=-5.3 required=5.0
    tests=AWL,BAYES_00,USER_AGENT_MOZILLA_UA version=2.55
    >X-Spam-Level:
    >X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
    >
    >How can I define my own colormap, i.e. with a pre-defined color table.
    >Say, I want to use color table "BlWhRe", but I would like to add one
    >more white in between, does anybody know how to do it? Thanks.
    >
    >Liz

    -------------------------------------------------------------
    Adam Phillips email: asphilli@ucar.edu
    Climate and Global Dynamics Division tel: (303) 497-1726
    National Center for Atmospheric Research fax: (303) 497-1333
    P.O. Box 3000
    Boulder, CO 80307-3000 http://www.cgd.ucar.edu/~asphilli

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Mon Aug 16 2004 - 09:22:24 MDT