code: def plot_species(statistics, view=False, filename='speciation.svg'):
      
      if plt is None:
          warnings.warn("This display is not available due to a missing optional dependency (matplotlib)")
          return
  
      species_sizes = statistics.get_species_sizes()
      num_generations = len(species_sizes)
      curves = np.array(species_sizes).T
  
      fig, ax = plt.subplots()
      ax.stackplot(range(num_generations), *curves)
  
      plt.title("Speciation")
      plt.ylabel("Size per Species")
      plt.xlabel("Generations")
  
      plt.savefig(filename)
  
      if view:
          plt.show()
  
      plt.close()
docs: Visualizes speciation throughout evolution.