tropea_clustering.plot.plot_sankey

tropea_clustering.plot.plot_sankey(title, labels, n_windows, tmp_frame_list)[source]

Plots the Sankey diagram at the desired frames.

Here’s an example of the output:

Example Image

For each of the selected frames, the colored bars width is proportional to each cluster population. The gray bands’ witdh are proportional to the number of data points moving from one cluster to the other between the selected frames. “State -1” refers to the unclassified data.

Parameters:
  • title (str) – The path of the .png file the figure will be saved as.

  • labels (ndarray of shape (n_particles * n_windows,)) – The output of the clustering algorithm.

  • n_windows (int) – The number of windows used.

  • tmp_frame_list (List[int]) – The list of windows at which we want to plot the Sankey.

Notes

  • If there are no assigned window, we still need the “-1” state for consistency

  • Requires kaleido.