Visualization

Visualization tools are included in prog_algs.visualize, described below:

prog_algs.visualize.plot_scatter(samples, fig=None, keys=None, legend='auto', **kwargs)

Produce a scatter plot for a given list of states

Parameters
  • samples ([dict]) – Non-empty list of states where each element is a dictionary containing a single sample

  • fig (Figure, optional) – Existing figure previously used to plot states. If passed a figure argument additional data will be added to the plot. Defaults to creating new figure

  • keys (list of strings, optional) – Keys to plot. Defaults to all keys.

  • legend (optional) – When the legend should be shown, options: False: Dont show legend “auto”: Show legend automatically if more than one data set True: Always show legend

  • **kwargs (optional) – Additional keyword arguments passed to scatter function. Includes those supported by scatter

Returns

Figure

Example

states = UnweightedSamples([1, 2, 3, 4, 5]) plot_scatter(states.sample(100)) # With 100 samples plot_scatter(states.sample(100), keys=[‘state1’, ‘state2’]) # only plot those keys