November 2016
Beginner to intermediate
941 pages
21h 55m
English
Let's look at how to animate a bubble plot. This is useful when you want to visualize data that's transient and dynamic.
import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation
tracker function that will dynamically update the bubble plot:def tracker(cur_num):
# Get the current index
cur_index = cur_num % num_points # Set the color of the datapoints
datapoints['color'][:, 3] = 1.0 # Update the size of the circles
datapoints['size'] += datapoints['growth']# Update the position of the oldest datapoint ...