added priors behaviour as intended and issue #38 closed and fixed

This commit is contained in:
Max Zwiessele 2013-06-04 18:09:02 +01:00
parent 29790e327a
commit 75f4e26b23
5 changed files with 16 additions and 16 deletions

View file

@ -218,20 +218,19 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
return means, covars
def plot_X_1d(self, fig=None, axes=None, fig_num="LVM mu S 1d", colors=None):
def plot_X_1d(self, ax=None, fignum=None, colors=None):
"""
Plot latent space X in 1D:
-if fig is given, create Q subplots in fig and plot in these
-if axes is given plot Q 1D latent space plots of X into each `axis`
-if neither fig nor axes is given create a figure with fig_num and plot in there
-if ax is given plot Q 1D latent space plots of X into each `axis`
-if neither fig nor ax is given create a figure with fignum and plot in there
colors:
colors of different latent space dimensions Q
"""
import pylab
if fig is None and axes is None:
fig = pylab.figure(num=fig_num, figsize=(8, min(12, (2 * self.X.shape[1]))))
fig = pylab.figure(num=fignum, figsize=(8, min(12, (2 * self.X.shape[1]))))
if colors is None:
colors = pylab.gca()._get_lines.color_cycle
pylab.clf()
@ -240,10 +239,10 @@ class Bayesian_GPLVM(sparse_GP, GPLVM):
plots = []
x = np.arange(self.X.shape[0])
for i in range(self.X.shape[1]):
if axes is None:
if ax is None:
ax = fig.add_subplot(self.X.shape[1], 1, i + 1)
else:
ax = axes[i]
ax = ax[i]
ax.plot(self.X, c='k', alpha=.3)
plots.extend(ax.plot(x, self.X.T[i], c=colors.next(), label=r"$\mathbf{{X_{{{}}}}}$".format(i)))
ax.fill_between(x,