[plotting] tests now compare the arrays of the figure, instead of the platform dependend png images

This commit is contained in:
Max Zwiessele 2016-04-12 08:44:48 +01:00
parent 2f901a90e2
commit 108ae55fbc
78 changed files with 97 additions and 30 deletions

View file

@ -112,7 +112,7 @@ def plot_latent_inducing(self,
which_indices=None,
legend=False,
plot_limits=None,
marker='^',
marker=None,
num_samples=1000,
projection='2d',
**kwargs):
@ -124,16 +124,18 @@ def plot_latent_inducing(self,
:param bool legend: whether to plot the legend on the figure
:param plot_limits: the plot limits for the plot
:type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ymax))
:param str marker: markers to use - cycle if more labels then markers are given
:param str marker: marker to use [default is custom arrow like]
:param kwargs: the kwargs for the scatter plots
"""
canvas, projection, kwargs, sig_dims = _new_canvas(self, projection, kwargs, which_indices)
Z = self.Z.values
labels = np.array(['inducing'] * Z.shape[0])
kwargs['marker'] = marker
if legend: label = 'inducing'
else: label = None
if marker is not None:
kwargs['marker'] = marker
update_not_existing_kwargs(kwargs, pl().defaults.inducing_2d) # @UndefinedVariable
scatters = _plot_latent_scatter(canvas, Z, sig_dims, labels, num_samples=num_samples, projection=projection, **kwargs)
from .data_plots import _plot_inducing
scatters = _plot_inducing(self, canvas, sig_dims[:2], projection, label, num_samples=num_samples, **kwargs)
return pl().add_to_canvas(canvas, dict(scatter=scatters), legend=legend)

View file

@ -45,7 +45,7 @@ it gives back an empty default, when defaults are not defined.
# Data plots:
data_1d = dict(lw=1.5, marker='x', color='k')
data_2d = dict(s=35, edgecolors='none', linewidth=0., cmap=cm.get_cmap('hot'), alpha=.5)
inducing_1d = dict(lw=0, s=500, facecolors=Tango.colorsHex['darkRed'])
inducing_1d = dict(lw=0, s=500, color=Tango.colorsHex['darkRed'])
inducing_2d = dict(s=17, edgecolor='k', linewidth=.4, color='white', alpha=.5, marker='^')
inducing_3d = dict(lw=.3, s=500, color=Tango.colorsHex['darkRed'], edgecolor='k')
xerrorbar = dict(color='k', fmt='none', elinewidth=.5, alpha=.5)

View file

@ -106,7 +106,7 @@ class MatplotlibPlots(AbstractPlottingLibrary):
return ax.plot(X, Y, color=color, zs=Z, label=label, **kwargs)
return ax.plot(X, Y, color=color, label=label, **kwargs)
def plot_axis_lines(self, ax, X, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs):
def plot_axis_lines(self, ax, X, color=Tango.colorsHex['darkRed'], label=None, **kwargs):
from matplotlib import transforms
from matplotlib.path import Path
if 'marker' not in kwargs:
@ -126,14 +126,14 @@ class MatplotlibPlots(AbstractPlottingLibrary):
bottom=bottom, label=label, color=color,
**kwargs)
def xerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs):
def xerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['darkRed'], label=None, **kwargs):
if not('linestyle' in kwargs or 'ls' in kwargs):
kwargs['ls'] = 'none'
#if Z is not None:
# return ax.errorbar(X, Y, Z, xerr=error, ecolor=color, label=label, **kwargs)
return ax.errorbar(X, Y, xerr=error, ecolor=color, label=label, **kwargs)
def yerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs):
def yerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['darkRed'], label=None, **kwargs):
if not('linestyle' in kwargs or 'ls' in kwargs):
kwargs['ls'] = 'none'
#if Z is not None: