Scatter plots

Inherits from PlotChecker.

class plotchecker.ScatterPlotChecker(axis)[source]

A plot checker for scatter plots.

Parameters:

axis : matplotlib.axes.Axes object

A set of matplotlib axes (e.g. obtained through plt.gca())

assert_num_points(num_points)[source]

Assert that the plot has the given number of points.

Parameters:num_points : int
x_data

The x-values of the plotted data (1-D array).

assert_x_data_equal(x_data)[source]

Assert that the given x-data is equivalent to the plotted x_data.

Parameters:

x_data : 1-D array-like

The expected x-data. The number of elements should be equal to the (expected) number of plotted points.

assert_x_data_allclose(x_data, **kwargs)[source]

Assert that the given x-data is almost equal to the plotted x_data.

Parameters:

x_data : 1-D array-like

The expected x-data. The number of elements should be equal to the (expected) number of plotted points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

y_data

The y-values of the plotted data (1-D array).

assert_y_data_equal(y_data)[source]

Assert that the given y-data is equivalent to the plotted y_data.

Parameters:

y_data : 1-D array-like

The expected y-data. The number of elements should be equal to the (expected) number of plotted points.

assert_y_data_allclose(y_data, **kwargs)[source]

Assert that the given y-data is almost equal to the plotted y_data.

Parameters:

y_data : 1-D array-like

The expected y-data. The number of elements should be equal to the (expected) number of plotted points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

colors

The colors of the plotted points. Columns correspond to RGB values.

assert_colors_equal(colors)[source]

Assert that the given colors are equivalent to the plotted colors.

Parameters:

colors : single color, or list of expected line colors

Each color can be either a matplotlib color name (e.g. 'r' or 'red'), a hexcode (e.g. "#FF0000"), a 3-tuple RGB color, or a 4-tuple RGBA color.

assert_colors_allclose(colors, **kwargs)[source]

Assert that the given colors are almost equal to the plotted colors.

Parameters:

colors : single color, or list of expected line colors

Each color can be either a matplotlib color name (e.g. 'r' or 'red'), a hexcode (e.g. "#FF0000"), a 3-tuple RGB color, or a 4-tuple RGBA color.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

alphas

The alpha values of the plotted points.

assert_alphas_equal(alphas)[source]

Assert that the given alpha values are equivalent to the plotted alphas.

Parameters:

alphas :

The expected alpha values. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

assert_alphas_allclose(alphas, **kwargs)[source]

Assert that the given alpha values are almost equal to the plotted alphas.

Parameters:

alphas :

The expected alpha values. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

edgecolors

The edge colors of the plotted points. Columns correspond to RGB values.

assert_edgecolors_equal(edgecolors)[source]

Assert that the given edge colors are equivalent to the plotted edgecolors.

Parameters:

edgecolors : single color, or list of expected edge colors

Each color can be either a matplotlib color name (e.g. 'r' or 'red'), a hexcode (e.g. "#FF0000"), a 3-tuple RGB color, or a 4-tuple RGBA color.

assert_edgecolors_allclose(edgecolors, **kwargs)[source]

Assert that the given edge colors are almost equal to the plotted edgecolors.

Parameters:

edgecolors : single color, or list of expected edge colors

Each color can be either a matplotlib color name (e.g. 'r' or 'red'), a hexcode (e.g. "#FF0000"), a 3-tuple RGB color, or a 4-tuple RGBA color.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

edgewidths

The edge widths of the plotted points.

assert_edgewidths_equal(edgewidths)[source]

Assert that the given edge widths are equivalent to the plotted edgewidths.

Parameters:

edgewidths :

The expected edge widths. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

assert_edgewidths_allclose(edgewidths, **kwargs)[source]

Assert that the given edge widths are almost equal to the plotted edgewidths.

Parameters:

edgewidths :

The expected edge widths. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

sizes

The size of the plotted points. This is the square of markersizes.

assert_sizes_equal(sizes)[source]

Assert that the given point sizes are equivalent to the plotted sizes.

Parameters:

sizes :

The expected point sizes. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

assert_sizes_allclose(sizes, **kwargs)[source]

Assert that the given point sizes are almost equal to the plotted sizes.

Parameters:

sizes :

The expected point sizes. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

markersizes

The marker size of the plotted points. This is the square root of sizes.

assert_markersizes_equal(markersizes)[source]

Assert that the given marker sizes are equivalent to the plotted markersizes.

Parameters:

markersizes :

The expected marker sizes. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

assert_markersizes_allclose(markersizes, **kwargs)[source]

Assert that the given marker sizes are almost equal to the plotted markersizes.

Parameters:

markersizes :

The expected marker sizes. This should either be a single number (which will apply to all the points) or an array with size equal to the number of (expected) points.

kwargs :

Additional keyword arguments to pass to numpy.testing.assert_allclose

markers

The marker styles of the plotted points. Unfortunately, this information is currently unrecoverable from matplotlib, and so this attribute is not actually implemented.

assert_markers_equal(markers)[source]

Assert that the given marker styles are equivalent to the plotted markers.

Note: information about marker style is currently unrecoverable from collections in matplotlib, so this method is not actually implemented.

Parameters:

markers :

The expected marker styles. This should either be a single style (which will apply to all the points) or an array with size equal to the number of (expected) points.