<div dir="ltr"><div><div><div>Hi Karin,<br><br></div>Rather than use gns_add_polyline, which associates the line with the plot, what about gsn_polyline, which just graphically overlays the line. I think I was able to achieve something like what you are after with the attached script. The essence of the drawing is this:<br><br> deltaLon = (lon2 - lon1) / 5.<br> deltaLat = (lat2 - lat1) / 5.<br> do i=0,4<br> draw(plot1)<br> gsn_polyline(wks, plot1, (/lon1+deltaLon*i, lon1+deltaLon*(i+1)/), \<br> (/lat1+deltaLat*i, lat1+deltaLat*(i+1)/), \<br> pres)<br> frame(wks)<br> end do<br><br></div>Hope that helps...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 20, 2016 at 3:50 PM, Karin Meier-Fleischer <span dir="ltr"><<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
is it possible to delete a polyline added to a simple map plot by<br>
gsn_add_polyline after it was drawn?<br>
<br>
I have flight trace data consisting of many segments per flight which I<br>
am animating segment by segment. This is not a problem. The idea now is<br>
to delete the first two segments after drawing 3 segments and further on<br>
to simulate a moving trace part to the end point (like a disappearing<br>
trail).<br>
<br>
The following snippet will cause an error:<br>
<br>
do n=0,nsegemnts-1<br>
str = unique_string("trace")<br>
map@$str$ =<br>
gsn_add_polyline(wks,map,(/x(n-1),x(n)/),(/y(n-1),y(n)/),pres)<br>
<br>
if(n .gt. 2) then<br>
trold0 = "trace"+(n-3)<br>
trold1 = "trace"+(n-2)<br>
delete([/map@$trold0$,map@$trold1$/])<br>
end if<br>
<br>
end do<br>
<br>
warning:TransformPostDraw: tfPolyDrawList element 0 is invalid<br>
warning:TransformPostDraw: tfPolyDrawList element 1 is invalid<br>
warning:Attempt to reference attribute (trace1) which is undefined<br>
<br>
<br>
Due to the huge number of segments I would want to 'switch' the first<br>
segments off, if possible, and not to draw each single plot from scratch<br>
again for each flight .<br>
<br>
Bye,<br>
Karin<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br></div>