code: def make_animation(
      results,
      colors,
      labels,
      perturbation_interval=None,
      filename="pbt.gif",
  ):
      fig, ax = plt.subplots(figsize=(8, 8))
  
      def animate(i):
          ax.clear()
          return plot_parameter_history(
              results,
              colors,
              labels,
              perturbation_interval=perturbation_interval,
              fig=fig,
              ax=ax,
              plot_until_iter=i,
              include_colorbar=False,
          )
  
      ani = FuncAnimation(
          fig,
          animate,
          interval=200,
          blit=True,
          repeat=True,
          frames=range(1, 101),
      )
      ani.save(filename, writer=PillowWriter())
      plt.close()
  
file_path: ray/doc/source/tune/examples/pbt_visualization/pbt_visualization_utils.py
imports: import matplotlib.pyplot
  from matplotlib.animation import FuncAnimation, PillowWriter
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: make_animation(results, colors, labels, perturbation_interval, filename) and returns: plot_parameter_history