[ncl-talk] animation: delete polyline from plot ?

Karin Meier-Fleischer meier-fleischer at dkrz.de
Fri May 20 15:50:50 MDT 2016


Hi,

is it possible to delete a polyline added to a simple map plot by 
gsn_add_polyline after it was drawn?

I have flight trace data consisting of many segments per flight which I 
am animating segment by segment. This is not a problem. The idea now is 
to delete the first two segments after drawing 3 segments and further on 
to simulate a moving trace part to the end point (like a disappearing 
trail).

The following snippet will cause an error:

do n=0,nsegemnts-1
    str = unique_string("trace")
    map@$str$ = 
gsn_add_polyline(wks,map,(/x(n-1),x(n)/),(/y(n-1),y(n)/),pres)

    if(n .gt. 2) then
       trold0 = "trace"+(n-3)
       trold1 = "trace"+(n-2)
       delete([/map@$trold0$,map@$trold1$/])
    end if

end do

warning:TransformPostDraw: tfPolyDrawList element 0 is invalid
warning:TransformPostDraw: tfPolyDrawList element 1 is invalid
warning:Attempt to reference attribute (trace1) which is undefined


Due to the huge number of segments I would want to 'switch' the first 
segments off, if possible, and not to draw each single plot from scratch 
again for each flight .

Bye,
Karin



More information about the ncl-talk mailing list