Generic plots¶

class
plotchecker.
PlotChecker
(axis)[source]¶ A generic object to test plots.
Parameters: axis :
matplotlib.axes.Axes
objectA set of matplotlib axes (e.g. obtained through
plt.gca()
)
title
¶ The title of the matplotlib plot, stripped of whitespace.

assert_title_equal
(title)[source]¶ Asserts that the given title is the same as the plotted
title
.Parameters: title : string
The expected title

xlabel
¶ The xlabel of the matplotlib plot, stripped of whitespace.

assert_xlabel_equal
(xlabel)[source]¶ Asserts that the given xlabel is the same as the plotted
xlabel
.Parameters: xlabel : string
The expected xlabel

ylabel
¶ The ylabel of the matplotlib plot, stripped of whitespace.

assert_ylabel_equal
(ylabel)[source]¶ Asserts that the given ylabel is the same as the plotted
ylabel
.Parameters: ylabel : string
The expected ylabel

xlim
¶ The xaxis limits of the matplotlib plot.

assert_xlim_equal
(xlim)[source]¶ Asserts that the given xlim is the same as the plot’s
xlim
.Parameters: xlim : 2tuple
The expected xlim

ylim
¶ The yaxis limits of the matplotlib plot.

assert_ylim_equal
(ylim)[source]¶ Asserts that the given ylim is the same as the plot’s
ylim
.Parameters: ylim : 2tuple
The expected ylim

xticks
¶ The tick locations along the plot’s xaxis.

assert_xticks_equal
(xticks)[source]¶ Asserts that the given xticks are the same as the plot’s
xticks
.Parameters: xticks : list
The expected tick locations on the xaxis

yticks
¶ The tick locations along the plot’s yaxis.

assert_yticks_equal
(yticks)[source]¶ Asserts that the given yticks are the same as the plot’s
yticks
.Parameters: yticks : list
The expected tick locations on the yaxis

xticklabels
¶ The tick labels along the plot’s xaxis, stripped of whitespace.

assert_xticklabels_equal
(xticklabels)[source]¶ Asserts that the given xticklabels are the same as the plot’s
xticklabels
.Parameters: xticklabels : list
The expected tick labels on the xaxis

yticklabels
¶ The tick labels along the plot’s yaxis, stripped of whitespace.

assert_yticklabels_equal
(yticklabels)[source]¶ Asserts that the given yticklabels are the same as the plot’s
yticklabels
.Parameters: yticklabels : list
The expected tick labels on the yaxis

textlabels
¶ The labels of all
matplotlib.text.Text
objects in the plot, excluding titles.

assert_textlabels_equal
(textlabels)[source]¶ Asserts that the given textlabels are the same as the plot’s
textlabels
.Parameters: textlabels : list
The expected text labels on the plot

textpoints
¶ The locations of all
matplotlib.text.Text
objects in the plot, excluding titles.

assert_textpoints_equal
(textpoints)[source]¶ Asserts that the given locations of the text objects are the same as the plot’s
textpoints
.Parameters: textpoints : arraylike, Nby2
The expected text locations on the plot, where the first column corresponds to the xvalues, and the second column corresponds to the yvalues.
