[ncl-talk] Color filled contour disappears with contour_shade pattern

S Br sbr.climate at gmail.com
Thu May 2 05:39:15 MDT 2019


Hi Users,
I am trying to plot a contour map filled with color and then apply patterns
to the values greater and smaller than the specified values using the
function gsn_contour_shade(plot,0.5,3.0,opt)

However, when I use the gsn_contour_shade and overlay, the contour filled
with color disappears. I can only see the patterns without the filled
contour. Please have a look at the attached image.
 I am using NCL6.4.0 and my script is given below.

Thank you, SB

begin

 in1 = addfile("precip.gpcp.mon.mean.nc","r")
  rain=in1->precip(0,:,:)
  printVarSummary(rain)
;************************************
;create plot
;************************************
  wks = gsn_open_wks("pdf","overlay")             ; send graphics to PNG
file
  res                     = True
  res at gsnDraw           = False         ; Don't draw plots
  res at gsnFrame          = False         ; Don't advance frame
  res at cnFillOn          = True          ; Turn on contour fill
  res at cnLinesOn         = False         ; Turn off contour lines
  res at cnFillPalette       = "MPL_YlOrRd"   ; set color map
  res at tiMainString        = "Overlaying shaded contours on filled contours"
;  res at cnFillMode = "RasterFill"
  res at cnLevelSelectionMode =  "ManualLevels"
  res at cnMinLevelValF       = 0.0
  res at cnMaxLevelValF       = 5.0
  res at cnLevelSpacingF      = 0.5

;   res at gsnAddCyclic     = False
   res at mpMinLatF    =   -10.0               ; only plot 30S to 30N
   res at mpMaxLatF    =  54.0
   res at mpMinLonF    = 30.0              ; only plot 30S to 30N
   res at mpMaxLonF    = 100.0

  plot = gsn_csm_contour_map(wks,rain,res)

  opt = True
  opt at gsnShadeFillType = "pattern"      ; pattern fill
  opt at gsnShadeHigh = 2                  ; use pattern #2
  opt at gsnShadeLow = 17                  ; use pattern #17
  plot2 = gsn_contour_shade(plot,0.5,3.0,opt)
  overlay(plot,plot2)

  draw(plot)
  frame(wks)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190502/3e3f268b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overlay.pdf
Type: application/pdf
Size: 94597 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190502/3e3f268b/attachment.pdf>


More information about the ncl-talk mailing list