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

Mary Haley haley at ucar.edu
Mon Aug 8 09:02:52 MDT 2016


Hi Adam

Glad you found the solution.  Basically, once you overlay a plot on top of
another, you can't overlay that plot on somebody else.  So, yes, you have
to create multiple copies of the same plot, if you need to overlay it
multiple times.

By the way, you can use a "list" to delete a bunch of things at once. A
list is denoted with [/ and /]:

delete([/tmp1,tmp3,tmp5/])

--Mary


On Mon, Aug 8, 2016 at 3:36 AM, Adam Herrington <
adam.herrington at stonybrook.edu> wrote:

> 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
>>
>>
>>
>>
>
> _______________________________________________
> 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/20160808/48276b43/attachment.html 


More information about the ncl-talk mailing list