[ncl-talk] plot overlaid on multiple base plots...take 2

Adam Herrington adam.herrington at stonybrook.edu
Sun Aug 7 19:36:32 MDT 2016


I found a work around to the problem - calling gsn_csm_contour for each
overlay. I think it works because it assigns a unique plot id to each
overlay. The revision new order looks like:

  res2 at cnFillOn          = False
  res2 at cnLinesOn         = True
  res2 at cnLineThicknessF  = 2.
  res2 at gsnContourNegLineDashPattern = 1
  res at gsnContourZeroLineThicknessF = 3.
  res2 at cnLevelSelectionMode = "ManualLevels"
  res2 at cnLevelSpacingF = 5.e10;
  tmp0  = gsn_csm_contour(wks,psi1,res2)

  tmp2  = gsn_csm_contour(wks,psi1,res2)
  tmp4  = gsn_csm_contour(wks,psi1,res2)
  overlay(plot(0),tmp0)
  overlay(plot(2),tmp2)
  overlay(plot(4),tmp4)
  delete(tmp0)
  delete(tmp2)
  delete(tmp4)

  res2 at cnLevelSpacingF = 1.e10
  tmp1  = gsn_csm_contour(wks,dpsi,res2)

  tmp3  = gsn_csm_contour(wks,dpsi,res2)
  tmp5  = gsn_csm_contour(wks,dpsi,res2)
  overlay(plot(1),tmp1)
  overlay(plot(3),tmp3)
  overlay(plot(5),tmp5)
  delete(tmp1)
  delete(tmp3)
  delete(tmp5)


On Sun, Aug 7, 2016 at 1:14 PM, Adam Herrington <
adam.herrington at stonybrook.edu> wrote:

> Hi all,
>
> I am struggling with overlaying a single contour plot (called 'tmp0'
> below) over multiple plots in a panel. The script below results in the
> error "fatal:NhlAddOverlay: tranform is already an annotation or overlay..."
>
>   plot(1)  = gsn_csm_contour(wks,dz_m,res1)
>   plot(3)  = gsn_csm_contour(wks,dy_m,res1)
>   res1 at tiXAxisString          = "Latitude"
>   plot(5)  = gsn_csm_contour(wks,dy_e,res1)
>   delete(res1 at tiXAxisString)
>
>   res2 at cnFillOn          = False
>   res2 at cnLinesOn         = True
>   res2 at cnLineThicknessF  = 2.
>   res2 at cnLevelSelectionMode = "ManualLevels"
>   res2 at cnLevelSpacingF = 5.e10;
>   tmp0  = gsn_csm_contour(wks,psi1,res2)
>
>   res2 at cnLevelSpacingF = 1.e10
>   tmp1  = gsn_csm_contour(wks,dpsi,res2)
>
>   overlay(plot(0),tmp0)
>   overlay(plot(2),tmp0) ;<-fatal:NhlAddOverlay
>   overlay(plot(4),tmp0) ;<-fatal:NhlAddOverlay
>   overlay(plot(1),tmp1)
>   overlay(plot(3),tmp1) ;<-fatal:NhlAddOverlay
>   overlay(plot(5),tmp1) ;<-fatal:NhlAddOverlay
> ...
>   gsn_panel(wks,plot,(/3,2/),resP)
>
> In terms of finding a solution, I would prefer to keep all the overlays
> contained in the graphics variable 'plot' so that I can easily perform a
> panel plot. I don't think the solution provided by Mary Haley in
> https://www.ncl.ucar.edu/Support/talk_archives/2013/3802.html would work
> for me, since gsn_panel draws all the plots at once.
>
> Any help is greatly appreciated!
>
> Adam
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160807/b2a37d0e/attachment.html 


More information about the ncl-talk mailing list