[ncl-talk] annotated map on contour plot is transparent rather than white

Guido Cioni guidocioni at gmail.com
Mon Feb 22 02:13:57 MST 2016


Hi Jatin,
did you try creating a new function that fill the background of an annotated plot? 

function fill_background(wks,plot,color)
local xmin,xmax,ymin,yma,gres,xbox,ybox
begin
  getvalues plot
    "trXMinF"  : xmin
    "trXMaxF"  : xmax
    "trYMinF"  : ymin
    "trYMaxF"  : ymax
  end getvalues

  xbox = (/xmin,xmax,xmax,xmin,xmin/)
  ybox = (/ymin,ymin,ymax,ymax,ymin/)

;---Resources for filling the polygon
  gres                 = True
  gres at gsFillColor     = color
  gres at tfPolyDrawOrder = "PreDraw"    ; This is necessary so that the 
                                      ; fill doesn't cover the curves.

;---Attach polygon to existing plot and return
  dum = gsn_add_polygon(wks,plot,xbox,ybox,gres)
  return(dum)
end

Attached you find an example of an application with pdf and NCL source file used to generate the plot. 
Hope this helps.

Cheers



Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/> 

> On 22 Feb 2016, at 06:51, Jatin Kala <jatin.kala.jk at gmail.com> wrote:
> 
> Hi,
> I am annotating a map on top of a contour plot. However, the map is being plotted as transparent rather than with white background.
> See attached, any suggestions on how to fix this? I've tried a couple of things, none have worked so far.
> Cheers,
> Jatin
> <plot_Trudy_precip.ncl><Trudy_precip_map.pdf>_______________________________________________
> 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/20160222/62979d28/attachment-0003.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: outfile_2.pdf
Type: application/pdf
Size: 91619 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/62979d28/attachment-0001.pdf 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/62979d28/attachment-0004.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_contour_2.ncl
Type: application/octet-stream
Size: 3378 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/62979d28/attachment-0001.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/62979d28/attachment-0005.html 


More information about the ncl-talk mailing list