[ncl-talk] animation: delete polyline from plot ?
Rick Brownrigg
brownrig at ucar.edu
Sat May 21 09:41:13 MDT 2016
Hi Karin,
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:
deltaLon = (lon2 - lon1) / 5.
deltaLat = (lat2 - lat1) / 5.
do i=0,4
draw(plot1)
gsn_polyline(wks, plot1, (/lon1+deltaLon*i, lon1+deltaLon*(i+1)/), \
(/lat1+deltaLat*i, lat1+deltaLat*(i+1)/), \
pres)
frame(wks)
end do
Hope that helps...
Rick
On Fri, May 20, 2016 at 3:50 PM, Karin Meier-Fleischer <
meier-fleischer at dkrz.de> wrote:
> 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
>
> _______________________________________________
> 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/20160521/17dd7184/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poly_14.ncl
Type: application/octet-stream
Size: 2441 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160521/17dd7184/attachment.obj
More information about the ncl-talk
mailing list