Re: state boundaries with mpFill = True

From: Mary Haley (haley AT XXXXXX)
Date: Wed Jun 11 2003 - 08:47:47 MDT

  • Next message: Mary Haley: "Re: 3-D scatter plots"

    >
    >
    > Hi: I'd like to get a map of the US superimposed on a gray background
    > (everything except the US masked out), but with the state boundaries
    > drawn. Here's my attempt
    >

    >
    > 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","test")
    > gsn_define_colormap(wks,"temp1")
    > res = True
    > res@mpMinLonF = 235
    > res@mpMaxLonF = 293
    > res@mpMinLatF = 24
    > res@mpMaxLatF = 50
    > res@mpOutlineBoundarySets = "GeophysicalandUSStates"
    > res@mpOutlineDrawOrder = "PostDraw"
    > res@mpFillOn = True
    > res@mpMaskAreaSpecifiers = "USStatesLand"
    > res@mpFillDrawOrder = "PreDraw"
    > res@mpFillAreaSpecifiers = (/"water","land","USStatesWater"/)
    > res@mpSpecifiedFillColors = (/3,3,3/)
    > res@mpUSStateLineColor = "red"
    > plot = gsn_csm_map_ce(wks,res)
    > end
    >
    >
    > This gives me a map with a white US superimposed on a gray background, but
    > no state boundaries. How do I get those state boundaries to show up?
    >
    > -Jeff

    Hi Jeff,

    You were almost there. You need to set mpAreaMaskingOn to True to
    turn on masking capabilities. Also, I changed your outlines from
    "GeophysicalandUSStates" to just "USStates" so that the outlines from
    the other countries didn't show. You can change it back if this is not
    what you want.

    Below is a new version of your script. I also set gsnMaximize to True.
    This will maximize your plot for whatever output device you use.

    Cheers,

    --Mary

    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","test")
      gsn_define_colormap(wks,"temp1")

      res = True
      res@gsnMaximize = True ; Maximize plot in frame.

      res@mpMinLonF = 235
      res@mpMaxLonF = 293
      res@mpMinLatF = 24
      res@mpMaxLatF = 50

    ;
    ; Use the mpFillAreaSpecifiers resource resource to indicate which
    ; areas you want to fill, and then use the mpMaskAreaSpecifiers resource
    ; to indicate which of that area *not* to fill. Make sure to turn
    ; on masking.
    ;
      res@mpAreaMaskingOn = True ; turn on masking
      res@mpFillAreaSpecifiers = (/"Water","Land"/) ; what parts to fill
      res@mpSpecifiedFillColors = (/ 3, 3 /) ; fill colors
      res@mpMaskAreaSpecifiers = "USStatesLand" ; what parts not to fill
    ;
    ; Outline US states in red.
    ;
      res@mpOutlineOn = True
      res@mpOutlineBoundarySets = "USStates"
      res@mpUSStateLineColor = "red"

      plot = gsn_csm_map_ce(wks,res)
    end

    -- 
    -------------------------------------------------
    Mary Haley                   haley AT ucar.edu
    NCAR/SCD/VETS                303-497-1254 (voice)
    1850 Table Mesa Dr           303-497-1804 (fax)
    Boulder, CO  80305
    -------------------------------------------------
    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk
    



    This archive was generated by hypermail 2b29 : Wed Jun 11 2003 - 09:07:39 MDT