Re: gsn_polymarker multiple colors

From: Chad Bahrmann (bahrmann AT meteo.psu.edu)
Date: Tue Nov 23 2004 - 12:56:11 MST

  • Next message: Mail System Internal Data: "DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA"

    Thank you for your prompt response. I attempted to use three default
    colors as you suggested. I changed the code below from the named colors to:
    res@gsMarkerColor =10
      gsn_polymarker(wks,map,anno_lon_bos,anno_lat_bos,res)
      res@gsMarkerColor =8
      gsn_polymarker(wks,map,anno_lon_ssi,anno_lat_ssi,res)
      res@gsMarkerColor =19
      gsn_polymarker(wks,map,anno_lon_nu,anno_lat_nu,res)

    and my polymarkers are still only showing in 2 colors. Please find the
    entire code below:

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
    ; ================================================;
    begin

      wks = gsn_open_wks("ps","maponly") ; open a ps file
    anno_lat_bos=(/40.327,41.229,40.653,41.838,42.151,41.481,41.449,41.481,42.105,41.88,41.121,42.123/)
    anno_lon_bos=(/-79.713,-75.928,-79.725,-79.178,-79.897,-80.166,-79.577,-79.994,-80.122,-80.177,-78.617,-79.998/)
    anno_lat_ssi=(/41.196,41.602,41.606,41.839,41.18,41.197,41.02,41.063,41.046,40.859,41.009,41.044,41.077,41.191,41.152,40.606,40.461,40.437,39.885,40.196,39.816,41.619/)
    anno_lon_ssi=(/-79.82,-79.609,-80.503,-79.008,-80.311,-80.161,-77.95,-77.214,-77.146,-78.162,-76.249,-76.02,-75.506,-79.514,-78.91,-79.047,-78.565,-78.906,-78.244,-78.976,-79.038,-77.118/)
    anno_lat_nu=(/39.949,39.821,39.85,39.795,40.116,40.426,41.267,40.344,39.798,39.956,40.447,40.792,40.067,40.194,40.6,40.734,40.154,40.195,40.198,40.317,40.35,40.562,40.836,41.165,41.314,41.354,41.87,40.45,40.933,41.943,41.099,41.808,40.815,40.725,41.93,41.708,41.011,40.741,40.55,40.442,41.71,40.862,41.765,41.379,40.974,40.667,41.196,41.602,41.606,41.839,41.18,41.197,41.02,41.063,41.046,40.859,41.009,41.044,41.077,41.191,41.152,40.606,40.461,40.437,39.885,40.196,39.816,40.425,41.619/)
    anno_lon_nu=(/-79.653,-79.774,-79.659,-80.076,-80.442,-80.429,-79.924,-79.662,-80.38,-79.364,-80.11,-80.125,-79.266,-78.685,-78.313,-77.636,-77.301,-76.661,-76.864,-76.924,-76.734,-75.986,-76.063,-75.956,-75.546,-75.375,-75.716,-79.157,-79.362,-80.502,-78.526,-76.899,-76.457,-78.35,-79.475,-78.694,-80.398,-80.371,-80.276,-79.827,-79.981,-75.295,-77.88,-78.687,-76.033,-76.389,-79.82,-79.609,-80.503,-79.008,-80.311,-80.161,-77.95,-77.214,-77.146,-78.162,-76.249,-76.02,-75.506,-79.514,-78.91,-79.047,-78.565,-78.906,-78.244,-78.976,-79.038,-76.522,-77.118/)
      res = True
      res@mpFillOn = False ; turn off gray fill

      res@lbPerimOn = False
      res@mpOutlineBoundarySets = "National" ; turn on country
    boundaries
      res@mpGeophysicalLineColor = "Gray50" ; color of cont. outlines
     res@mpGeophysicalLineThicknessF = 1 ; thickness of outlines
     res@mpOutlineBoundarySets = "AllBoundaries" ; add state boundaries
     res@mpUSStateLineColor = "black" ; make them red
     res@mpUSStateLineThicknessF = 1.25 ; thickness of outlines
     res@mpDataBaseVersion = "Ncarg4_1"
     res@mpDataSetName = "Earth..2"

      res@mpMaxLatF = 43 ; choose subregion
      res@mpMinLatF = 39
      res@mpMaxLonF = -74
      res@mpMinLonF = -81
      res@gsnMaximize =True
      res@gsnDraw=False
      res@gsnFrame=False
      map = gsn_csm_map_ce(wks,res) ; draw map
      res@gsMarkerIndex = 16 ; polymarker style
      res@gsMarkerSizeF = 6 ; polymarker size
      draw(map)
      res@gsMarkerColor =10
      gsn_polymarker(wks,map,anno_lon_bos,anno_lat_bos,res)
      res@gsMarkerColor =8
      gsn_polymarker(wks,map,anno_lon_ssi,anno_lat_ssi,res)
      res@gsMarkerColor =19
      gsn_polymarker(wks,map,anno_lon_nu,anno_lat_nu,res)
      frame(wks)
      end

    Adam Phillips wrote:

    >Chad,
    >
    >I am guessing that you have not changed the colormap, and thus are using the
    >default NCL colormap.
    >
    >To change from the default color map: gsn_define_colormap(wks,"temp1")
    >(see http://ngwww.ucar.edu/ncl/coltable.html for a listing of available color
    >maps.)
    >
    >In your case, you might just want to add one color to the existing colormap. You
    >can do this by using the NhlNewColor function:
    >
    >nc1 = NhlNewColor(wks,.45,.1,.1) ;firebrick4?
    >
    >When you specify a color by name, in your case FireBrick4, NCL tries to find the
    >color closest to the one you specified. For whatever reason, I am guessing that
    >NCL thinks the closest color in the default colormap to FireBrick4 is dark
    >green.
    >
    >Another good color map web site:
    >http://ngwww.ucar.edu/ngdoc/ng/ug/ncl/gsun/basics.html#ColorMaps
    >
    >Adam
    >
    >
    >
    >>Delivered-To: asphilli@ucar.edu
    >>Delivered-To: ncl-talk@ucar.edu
    >>Date: Tue, 23 Nov 2004 12:21:44 -0500
    >>From: Chad Bahrmann <bahrmann@meteo.psu.edu>
    >>User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
    >>X-Accept-Language: en-us, en
    >>MIME-Version: 1.0
    >>To: ncl-talk@ucar.edu
    >>Content-Transfer-Encoding: 7bit
    >>X-Mailman-Approved-At: Tue, 23 Nov 2004 10:51:58 -0700
    >>Subject: gsn_polymarker multiple colors
    >>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-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on mscan4.ucar.edu
    >>X-Spam-Level:
    >>X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00
    >>
    >>
    >autolearn=unavailable version=3.0.1
    >
    >
    >>I am trying to get some polymarkers on a map with 3 distinct colors.
    >>However, I get the first and last colors requested but the second
    >>requested markers are ploted with the last color requested. See below.
    >>I get the Blue and Green but not the FireBrick.
    >>
    >>res = True
    >> res@mpFillOn = False ; turn off gray fill
    >>
    >> res@lbPerimOn = False
    >> res@mpOutlineBoundarySets = "National" ; turn on country
    >>boundaries
    >> res@mpGeophysicalLineColor = "Gray50" ; color of cont. outlines
    >>res@mpGeophysicalLineThicknessF = 1 ; thickness of outlines
    >>res@mpOutlineBoundarySets = "AllBoundaries" ; add state boundaries
    >>res@mpUSStateLineColor = "black" ; make them red
    >>res@mpUSStateLineThicknessF = 1.25 ; thickness of outlines
    >>res@mpDataBaseVersion = "Ncarg4_1"
    >>res@mpDataSetName = "Earth..2"
    >>
    >>
    >> res@mpMaxLatF = 43 ; choose subregion
    >> res@mpMinLatF = 39
    >> res@mpMaxLonF = -74
    >> res@mpMinLonF = -81
    >> res@gsnMaximize =True
    >> res@gsnDraw=False
    >> res@gsnFrame=False
    >> map = gsn_csm_map_ce(wks,res) ; draw map
    >> res@gsMarkerIndex = 16 ; polymarker style
    >> res@gsMarkerSizeF = 6 ; polymarker size
    >> draw(map)
    >> res@gsMarkerColor ="NavyBlue"
    >> gsn_polymarker(wks,map,anno_lon_bos,anno_lat_bos,res)
    >> res@gsMarkerColor ="FireBrick4"
    >> gsn_polymarker(wks,map,anno_lon_ssi,anno_lat_ssi,res)
    >> res@gsMarkerColor ="DarkGreen"
    >> gsn_polymarker(wks,map,anno_lon_nu,anno_lat_nu,res)
    >> frame(wks)
    >>
    >>
    >>_______________________________________________
    >>ncl-talk mailing list
    >>ncl-talk@ucar.edu
    >>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    >>
    >>
    >
    >-------------------------------------------------------------
    >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 : Wed Nov 24 2004 - 09:32:08 MST