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

Rick Brownrigg brownrig at ucar.edu
Thu May 2 09:45:07 MDT 2019


The docs for gsn_contour_shade() state:

You cannot mix and match color and shading with this routine. For an
example of drawing shaded and filled contours, see example coneff_14.ncl
<http://ncl.ucar.edu/Applications/coneff.shtml#ex14>.

However, that example coneff_14 shows how to achieve the result via two
calls to gsn_csm_contour():

http://ncl.ucar.edu/Applications/coneff.shtml#ex14

Hope that helps...
Rick

On Thu, May 2, 2019 at 5:39 AM S Br <sbr.climate at gmail.com> wrote:

> 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
> _______________________________________________
> 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/20190502/dcfa6ea4/attachment.html>


More information about the ncl-talk mailing list