From e9260b248cf4e9881333c43af126915fa1a3c2c1 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Mon, 12 May 2014 14:41:02 +0100 Subject: [PATCH] [visualize] vector show again --- GPy/examples/dimensionality_reduction.py | 4 ++-- GPy/plotting/matplot_dep/visualize.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/GPy/examples/dimensionality_reduction.py b/GPy/examples/dimensionality_reduction.py index ac1c50ee..43ba5937 100644 --- a/GPy/examples/dimensionality_reduction.py +++ b/GPy/examples/dimensionality_reduction.py @@ -177,7 +177,7 @@ def bgplvm_oil(optimize=True, verbose=1, plot=True, N=200, Q=7, num_inducing=40, if plot: fig, (latent_axes, sense_axes) = plt.subplots(1, 2) m.plot_latent(ax=latent_axes, labels=m.data_labels) - data_show = GPy.plotting.matplot_dep.visualize.vector_show(np.zeros((m.Y.shape[1], 1))) + data_show = GPy.plotting.matplot_dep.visualize.vector_show((m.Y[0,:])) lvm_visualizer = GPy.plotting.matplot_dep.visualize.lvm_dimselect(param_to_array(m.X.mean)[0:1,:], # @UnusedVariable m, data_show, latent_axes=latent_axes, sense_axes=sense_axes) raw_input('Press enter to finish') @@ -186,7 +186,7 @@ def bgplvm_oil(optimize=True, verbose=1, plot=True, N=200, Q=7, num_inducing=40, def _simulate_sincos(D1, D2, D3, N, num_inducing, Q, plot_sim=False): _np.random.seed(1234) - + x = _np.linspace(0, 4 * _np.pi, N)[:, None] s1 = _np.vectorize(lambda x: _np.sin(x)) s2 = _np.vectorize(lambda x: _np.cos(x)**2) diff --git a/GPy/plotting/matplot_dep/visualize.py b/GPy/plotting/matplot_dep/visualize.py index b26910c4..fb443de1 100644 --- a/GPy/plotting/matplot_dep/visualize.py +++ b/GPy/plotting/matplot_dep/visualize.py @@ -77,13 +77,12 @@ class vector_show(matplotlib_show): #assert vals.ndim == 2, "Please give a vector in [n x 1] to plot" #assert vals.shape[1] == 1, "only showing a vector in one dimension" self.size = vals.size - - self.handle = self.axes.plot(np.arange(0, vals.size)[:, None], self.vals)[0] + self.handle = self.axes.plot(np.arange(0, vals.size)[:, None], vals)[0] def modify(self, vals): self.vals = vals.copy() xdata, ydata = self.handle.get_data() - assert vals.size == self.size, "values passed into modify changed size! vals:{} != in:{}".format(vals.size, self.size) + assert vals.size == self.size, "values passed into modify changed size! vals.size:{} != in.size:{}".format(vals.size, self.size) self.handle.set_data(xdata, self.vals) self.axes.figure.canvas.draw()