def plot_df_pie(df: pd.DataFrame,
                scale: Collection[str],
                title: str = 'Metric',
                group_by: str = 'player',
                value: str = 'value_str') -> None:
  """Plots a pie chart of a dataframe.

  Args:
    df: The dataframe containing the data to plot.
    scale: The set of possible values to plot.
    title: The title of the plot.
    group_by: Group data by this field, plot each one in its own figure.
    value: The name of the value to aggregate for the pie chart regions.
  """
  cmap = mpl.colormaps['Paired']  # pylint: disable=unsubscriptable-object
  colours = cmap(range(len(scale)))
  scale_to_colour = dict(zip(scale, colours))

  for player, group_df in df.groupby(group_by):
    plt.figure()
    counts = group_df[value].value_counts()
    plt.pie(
        counts,
        labels=counts.index,
        colors=[scale_to_colour[color] for color in counts.index],
    )
    plt.title(f'{title} of {player}')
Plots a pie chart of a dataframe.

  Args:
    df: The dataframe containing the data to plot.
    scale: The set of possible values to plot.
    title: The title of the plot.
    group_by: Group data by this field, plot each one in its own figure.
    value: The name of the value to aggregate for the pie chart regions.
  
concordia/utils/plotting.py