The Plotting Module

qexpy.plotting.plotting.plot(*args, **kwargs)[source]

Plots a dataset or a function

Adds a dataset or a function to a Plot, and returns the Plot object. This is a wrapper around the matplotlib.pyplot.plot function, so it takes all the keyword arguments that is accepted by the pyplot.plot function, as well as the pyplot.errorbar function.

By default, error bars are not displayed. If you want error bars, it can be turned on in the Plot object.

Parameters

*args – The first arguments can be an XYDataSet object, two separate arrays for xdata and ydata, a callable function, or an XYFitResult object. The function also takes a string at the end of the list of arguments as the format string.

Return type

Plot

qexpy.plotting.plotting.hist(*args, **kwargs)[source]

Plots a histogram with a data set

Parameters

*args – the ExperimentalValueArray or arguments that creates an ExperimentalValueArray

See also

hist()

Return type

tuple

qexpy.plotting.plotting.show(plot_obj=None)[source]

Draws the plot to output

The QExPy plotting module keeps a buffer on the last plot being operated on. If no Plot instance is supplied to this function, the buffered plot will be shown.

Parameters

plot_obj (Plot) – the Plot instance to be shown.

The Plot Object

class qexpy.plotting.plotting.Plot[source]

The data structure used for a plot

Properties

Plot.title

The title of this plot, which will appear on top of the figure

Type

str

Plot.xname

The name of the x data, which will appear as x label

Type

str

Plot.yname

The name of the y data, which will appear as y label

Type

str

Plot.xunit

The unit of the x data, which will appear on the x label

Type

str

Plot.yunit

The unit of the y data, which will appear on the y label

Type

str

Plot.xlabel

The xlabel of the plot

Type

str

Plot.ylabel

the ylabel of the plot

Type

str

Plot.xrange

The x-value domain of this plot

Type

tuple

Methods

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

Adds a data set or function to the plot

See also

plot()

Plot.hist(*args, **kwargs)[source]

Adds a histogram to the plot

See also

hist()

Plot.fit(*args, **kwargs)[source]

Plots a curve fit to the last data set added to the figure

The fit function finds the last data set or histogram added to the Plot and apply a fit to it. This function takes the same arguments as QExPy fit function, and the same keyword arguments as in the QExPy plot function in configuring how the line of best fit shows up on the plot.

See also

fit() plot()

Plot.show()[source]

Draws the plot to output

Plot.legend(new_setting=True)[source]

Add or remove legend to plot

Plot.error_bars(new_setting=True)[source]

Add or remove error bars from plot

Plot.residuals(new_setting=True)[source]

Add or remove subplot to show residuals