kern plotting with axisa

This commit is contained in:
Max Zwiessele 2013-04-11 15:47:18 +01:00
parent e99993b8ce
commit dcbd76a6ee
3 changed files with 31 additions and 21 deletions

View file

@ -52,7 +52,7 @@ class kern(parameterised):
parameterised.__init__(self)
def plot_ARD(self):
def plot_ARD(self, ax=pb.gca()):
"""
If an ARD kernel is present, it bar-plots the ARD parameters
@ -60,16 +60,16 @@ class kern(parameterised):
"""
for p in self.parts:
if hasattr(p, 'ARD') and p.ARD:
pb.figure()
pb.title('ARD parameters, %s kernel' % p.name)
ax.set_title('ARD parameters, %s kernel' % p.name)
if p.name == 'linear':
ard_params = p.variances
else:
ard_params = 1./p.lengthscale
pb.bar(np.arange(len(ard_params))-0.4, ard_params)
ax.bar(np.arange(len(ard_params)) - 0.4, ard_params)
ax.set_xticks(np.arange(len(ard_params)),
["${}$".format(i + 1) for i in range(len(ard_params))])
def _transform_gradients(self,g):