So I'm using R to plot a list of x and y points of hockey players on a TV screen. However, since the camera is moving, some players will enter the screen and others will leave. In my dataset, I set the x and y coordinates of players not in the frame to (0,0) and if they are in the frame then it is (x,y) with x and y being whatever their coordinates are. However, when I plot there points in ggplot() (using geom_path()) it looks good until they go off screen, then the line jumps all the way to 0,0.
Is there any way that I can add some condition to my code where if the (x,y) coordinates equal 0 at any point, then it doesn't plot it on my graph? It would really clean up my presentation and would help show their tracking when on the ice. Thank you for any help you can provide.