pyexperiment.utils.plot

Provides setup utilities for matplotlib figures.

The setup_plotting function will configure basic plot options, such as font size, line width, etc. Calls after the first call are ignored unless the override flag is set to True. The setup_figure function will call setup_plotting without overriding an existing setup, and then return the handle to a new figure, pre-configured with the ‘q’ key bound to close the figure.

The AsyncPlot class provides a simple way to plot some datapoints in a separate process without blocking the execution of the main program. Just create an AsyncPlot object and use the plot method. By default, the window created by the AsyncPlot will stay open until you close it. To close the window programatically, call the close method on the AsyncPlot object.

Written by Peter Duerr.

class pyexperiment.utils.plot.AsyncPlot(name=u'pyexperiment', labels=None, x_scale=u'linear', y_scale=u'linear')[source][source]

Plot asynchronously in a different process

close()[source][source]

Close the figure, join the process

plot(*args, **kwargs)[source][source]

Plots the data in the separate process

static plot_process(queue, name, labels=None, x_scale=u'linear', y_scale=u'linear')[source][source]

Grabs data from the queue and plots it in a named figure

pyexperiment.utils.plot.quit_figure_on_key(key, figure=None)[source][source]

Add handler to figure (defaults to current figure) that closes it on a key press event.

pyexperiment.utils.plot.setup_figure(name=u'pyexperiment')[source][source]

Setup a figure that can be closed by pressing ‘q’ and saved by pressing ‘s’.

pyexperiment.utils.plot.setup_plotting(options=None, override_setup=True)[source][source]

Setup basic style for matplotlib figures