plot_array#

plot_array(expected, fig=None, ax=None, **kwargs)[source]#

Plot histogram on a sorted array based by names. If names not provided the order will be used. If generate data is not provided, plot only the expected values. Note this can only be used with the limitation that data that has already been binned. Figure will be saved in figdir if given or else working directory.

Parameters:
  • expected (array) – Array of expected values

  • fig (matplotlib.figure) – Matplotlib.figure object

  • ax (matplotlib.axis) – Matplotlib.axes object

  • **xvalue (array) – Array of values used in X-axis, must be the same length as expected

  • **generated (array) – Array of values generated using a model

  • **names (list or dict) – names to display on x-axis, default is set to the indexes of data

  • **figname (str) – name to save figure to disk

  • **figdir (str) – directory to save the plot if provided

  • **prefix (str) – used to prefix the title of the plot

  • **fontsize (float) – default fontsize

  • **color_1 (str) – color for expected data

  • **color_2 (str) – color for generated data

  • **expect_label (str) – Label to show in the plot, default to “expected”

  • **value_text (bool) – If True, display the values on top of the bar if specified

  • **rotation (float) – rotation angle for xticklabels

  • **binned (bool) – If True, data are binned. Else, if False, plot a simple histogram for expected data.

  • **do_show (bool) – If True, show the plot

  • **do_save (bool) – If True, save the plot to disk

Returns:

Matplotlib figure and axes.