chirunconf / chirunconf19

Discussion of potential projects for Chicago R Unconference, March 9-10, 2019
16 stars 2 forks source link

gganimation of fish schooling #17

Open alexpghayes opened 5 years ago

alexpghayes commented 5 years ago

I recall seeing an animation of schooling fish somewhere a while back a long time ago and it could be interesting to recreate with R and gganimate as a tutorial touching on gganimate and perhaps on a workflow using both matrices / arrays and tibbles.

Anyway, if you have a bunch of "fish" (points (x1, y1), (x2, y2), ..., (xn, yn)), IIRC you can simulate schooling behavior by moving each fish toward the center of the school, but adding some random noise so they don't go exactly in the direction of the center.

I'm fairly sure this is right. Part of the adventure would be that it could be totally wrong.