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 x-axis 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 : 2-tuple
The expected xlim
-
ylim
¶ The y-axis 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 : 2-tuple
The expected ylim
-
xticks
¶ The tick locations along the plot’s x-axis.
-
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 x-axis
-
yticks
¶ The tick locations along the plot’s y-axis.
-
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 y-axis
-
xticklabels
¶ The tick labels along the plot’s x-axis, 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 x-axis
-
yticklabels
¶ The tick labels along the plot’s y-axis, 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 y-axis
-
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 : array-like, N-by-2
The expected text locations on the plot, where the first column corresponds to the x-values, and the second column corresponds to the y-values.
-
assert_textpoints_allclose
(textpoints, **kwargs)[source]¶ Asserts that the given locations of the text objects are almost the same as the plot’s
textpoints
.Parameters: textpoints : array-like, N-by-2
The expected text locations on the plot, where the first column corresponds to the x-values, and the second column corresponds to the y-values.
kwargs :
Additional keyword arguments to pass to
numpy.testing.assert_allclose
-