pyphi.visualize.distribution.plot_distribution#

pyphi.visualize.distribution.plot_distribution(*distributions, states=None, label=None, figsize=(9, 3), fig=None, ax=None, lineplot_threshold=64, title=None, y_label='Pr(state)', validate=True, labels=None, **kwargs)[source]#

Plot one or more distributions over states.

Distributions with at most lineplot_threshold states are drawn as a bar panel; larger ones are drawn as a line plot.

Parameters:
  • *distributions (array_like) – The distributions to plot. If no states are provided, each must have length equal to a power of 2. Multidimensional distributions are flattened with pyphi.distribution.flatten().

  • states (Iterable or None, optional) – The states corresponding to the probabilities; if None, states are inferred from the length of the distribution assuming little-endian bit-string ordering.

  • label (str or None, optional) – State-space label drawn beneath the bar panel. Defaults to the unit names (A, B, …) inferred alongside bit-string states.

  • figsize (tuple of float, optional) – Figure size, used only when a new figure is created.

  • fig (matplotlib.figure.Figure or None, optional) – Existing figure to draw into.

  • ax (matplotlib.axes.Axes or None, optional) – Existing axes to draw into.

  • lineplot_threshold (int, optional) – Above this many states, the distribution is drawn as a line plot rather than a bar plot.

  • title (str or None, optional) – Axes title.

  • y_label (str, optional) – Y-axis label.

  • validate (bool, optional) – If true, check that each distribution sums to 1 and that their indices match.

  • labels (list of str or None, optional) – Series labels shown in the legend; default is the series index.

  • **kwargs – Passed to seaborn.barplot() (or seaborn.lineplot() above lineplot_threshold).

Returns:

tuple – The matplotlib figure and axes.