How it works...
Here is the explanation of the preceding code blocks.
The first three steps are familiar to you, except that in each of the plot statements we add an extra argument, animated=True, to indicate that the artist is going to be part of the animation.
lines = [l1, l2, l3, l4, l5, l6, l7, l8] is the list of all the artists, defined in step 2, to be part of the animation, which is passed to ArtistAnimation as an argument.
ani = ArtistAnimation(fig, lines, blit=True, interval=1000, repeat=True, repeat_delay=2500) activates the animation by displaying one artist at a time, with a time interval of 1,000 milliseconds, and repeats the cycle with a time delay of 2,500 milliseconds.
Here is how the output looks. You can also see ROC_Curves.mp4 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access