code: def create_multi_binary_relative_bar_plot(
      value: List[Tuple[np.ndarray, int]]
  ) -> plt.Figure:
      """
      Counts the categories in value and prepares a relative bar plot of these.
  
      :param value: List of Tuples of (action, action_dim)
      :return: plt.figure that contains a bar plot
      """
      # This plotting function can be used by several events. depending on whether
      action_arrays = [
          action_dim_tuple[0] for action_dim_tuple in value
      ]
      action_dim = value[0][1]
      # count the action categories
      cat_counts = np.sum(action_arrays, axis=-2)
      max_counts = len(action_arrays)
  
      # make bar plot where the frequencies of the categories are divided by the sum of the frequencies
      # in order to imitate a probability distribution
      fig_size = (min(14, max(7, action_dim // 2)), 7)
      fig = plt.figure(figsize=fig_size)
      plt.bar(x=range(action_dim), height=cat_counts / max_counts)
      plt.ylim([0, 1])
      return fig
  
file_path: maze/maze/core/log_events/log_create_figure_functions.py
imports: from collections import Counter
  from typing import List, Tuple, Union
  import matplotlib.pyplot
  import numpy
  from maze.core.annotations import unused
label_desc: Use image node_id 4 for calling a global function with example usage: create_multi_binary_relative_bar_plot(value) and returns: fig