Plotting

Module that provides unit-aware plotting functions that can be used as a drop-in replacement for matplotlib.pyplot.

Also acts as a repository for useful plotting tools, like slider-plots.

instrumental.plotting.param_plot(x, func, params, **kwargs)

Plot a function with user-adjustable parameters.

Parameters:

x : array_like

Independent (x-axis) variable.

func : function

Function that takes as its first argument an independent variable and as subsequent arguments takes parameters. It should return an output array the same dimension as x, which is plotted as the y-variable.

params : dict

Dictionary whose keys are strings named exactly as the parameter arguments to func are. [More info on options]

Returns:

final_params : dict

A dict whose keys are the same as params and whose values correspond to the values selected by the slider. final_params will continue to change until the figure is closed, at which point it has the final parameter values the user chose. This is useful for hand-fitting curves.

instrumental.plotting.plot(*args, **kwargs)

Quantity-aware wrapper of pyplot.plot

instrumental.plotting.xlabel(s, *args, **kwargs)

Quantity-aware wrapper of pyplot.xlabel

Automatically adds parenthesized units to the end of s.

instrumental.plotting.ylabel(s, *args, **kwargs)

Quantity-aware wrapper of pyplot.ylabel.

Automatically adds parenthesized units to the end of s.