[ncl-talk] Overlay on two plots

Carl Schreck cjschrec at ncsu.edu
Fri Jan 4 09:54:00 MST 2019


Sorry for not being clear, that actually is what I want to do... Overlay a
onto both b & c. The workaround I'm using now is to have my function return
an array. Something like:

a = new( 2, graphic )
a(0) = gsn_csm_contour( wks, aData, res )
a(1) = gsn_csm_contour( wks, aData, res )
b = gsn_csm_contour( wks, bData, res )
c = gsn_csm_contour( wks, cData, res )

overlay( b, a(0) )
overlay( c, a(1) )

On Fri, Jan 4, 2019 at 10:35 AM James Russell <jorussel at ncsu.edu> wrote:

> Carl,
>
> I haven’t had a chance to check since I’m on my phone but I think that’s
> happening because you’ve got the overlay order reversed. The base plot
> should be the first index. The overlay should be the second. I think you
> should have:
>
> overlay(a,b)
> overlay(a,c)
>
> What I think you are doing is overlaying a onto b, and then trying to
> overlay a onto c. But a is already an overlay on b, hence why you are
> getting that error.
>
> Thanks,
> James
>
> On Fri, Jan 4, 2019 at 8:02 AM Carl Schreck <cjschrec at ncsu.edu> wrote:
>
>> Is there any workaround to be able to overlay one plot onto two others?
>> i.e.,
>>
>> a = gsn_csm_contour( wks, aData, res )
>> b = gsn_csm_contour( wks, bData, res )
>> c = gsn_csm_contour( wks, cData, res )
>>
>> overlay( b, a )
>> overlay( c, a )
>>
>> That gives the error:
>> fatal:NhlAddOverlay: tranform is already an annotation or overlay: 30
>>
>> I tried simply copying a:
>> a = a2
>> overlay( b, a )
>> overlay( c, a2 )
>>
>> But that gives the same error. I know it's not too difficult to call the
>> plotting routine twice. But a lot of times I have graphics as return values
>> from functions, so it'd be nice if there were some kind of copy_graphics
>> function so I wouldn't have to run those again.
>>
>> First world problems, but figured I'd ask... Thanks!
>> Carl
>>
>> --
>>
>> <https://ncics.org/> *Carl J. Schreck III, PhD*
>> *Research Scholar*
>> North Carolina State University <http://ncsu.edu/>
>> North Carolina Institute for Climate Studies (NCICS) <https://ncics.org/>
>> 151 Patton Ave, Asheville, NC 28801
>> e: cjschrec at ncsu.edu
>> o: +1 828 257 3140 <(828)%20257-3140>
>> c: +1 828 484 1702 <(828)%20484-1702>
>> Publications
>> <http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
>> ncics.org/mjo
>> CycloneCenter.org <https://www.cyclonecenter.org/>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> --
> This message was sent from my mobile device. Sorry for the brevity!
>
> go.ncsu.edu/james-russell
>


-- 

<https://ncics.org/> *Carl J. Schreck III, PhD*
*Research Scholar*
North Carolina State University <http://ncsu.edu/>
North Carolina Institute for Climate Studies (NCICS) <https://ncics.org/>
151 Patton Ave, Asheville, NC 28801
e: cjschrec at ncsu.edu
o: +1 828 257 3140 <(828)%20257-3140>
c: +1 828 484 1702 <(828)%20484-1702>
Publications
<http://scholar.google.com/citations?hl=en&user=th8ONEcAAAAJ&view_op=list_works&sortby=pubdate>
ncics.org/mjo
CycloneCenter.org <https://www.cyclonecenter.org/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190104/3b38656c/attachment.html>


More information about the ncl-talk mailing list